Commit 50dc57c4 authored by Tom Rini's avatar Tom Rini Committed by Sam Ravnborg

kbuild: warning fixes on Solaris 9

The following set of patches is based loosely on the patches that
Jean-Christophe Dubois came up with for 2.6.7.  Where as the original
patches added a number of casts to unsigned char, I went the route of
making the chars be explicitly signed.  I honestly don't know which
route is better to go down.  Doing this is the bulk of the patch.  Out
of the rest of the odds 'n ends is that on Solaris, Elf32_Word is a
ulong, which means all of the printf's are unhappy (uint format, ulong
arg) for most of the typedefs.
Signed-off-by: default avatarTom Rini <trini@kernel.crashing.org>
Signed-off-by: default avatarSam Ravnborg <sam@ravnborg.org>
parent 298039e7
...@@ -96,7 +96,7 @@ void write_bugboot_header(int32_t out_fd, uint32_t boot_size) ...@@ -96,7 +96,7 @@ void write_bugboot_header(int32_t out_fd, uint32_t boot_size)
uint8_t header_block[HEADER_SIZE]; uint8_t header_block[HEADER_SIZE];
bug_boot_header_t *bbh = (bug_boot_header_t *)&header_block[0]; bug_boot_header_t *bbh = (bug_boot_header_t *)&header_block[0];
bzero(header_block, HEADER_SIZE); memset(header_block, 0, HEADER_SIZE);
/* Fill in the PPCBUG ROM boot header */ /* Fill in the PPCBUG ROM boot header */
strncpy(bbh->magic_word, "BOOT", 4); /* PPCBUG magic word */ strncpy(bbh->magic_word, "BOOT", 4); /* PPCBUG magic word */
......
...@@ -52,7 +52,7 @@ FILEONLY *internalfunctions; ...@@ -52,7 +52,7 @@ FILEONLY *internalfunctions;
FILEONLY *externalfunctions; FILEONLY *externalfunctions;
FILEONLY *symbolsonly; FILEONLY *symbolsonly;
typedef void FILELINE(char * file, char * line); typedef void FILELINE(char * file, signed char * line);
FILELINE * singlefunctions; FILELINE * singlefunctions;
FILELINE * entity_system; FILELINE * entity_system;
...@@ -148,9 +148,9 @@ struct symfile * filename_exist(char * filename) ...@@ -148,9 +148,9 @@ struct symfile * filename_exist(char * filename)
* Files are separated by tabs. * Files are separated by tabs.
*/ */
void adddep(char * file) { printf("\t%s", file); } void adddep(char * file) { printf("\t%s", file); }
void adddep2(char * file, char * line) { line = line; adddep(file); } void adddep2(char * file, signed char * line) { line = line; adddep(file); }
void noaction(char * line) { line = line; } void noaction(char * line) { line = line; }
void noaction2(char * file, char * line) { file = file; line = line; } void noaction2(char * file, signed char * line) { file = file; line = line; }
/* Echo the line without further action */ /* Echo the line without further action */
void printline(char * line) { printf("%s", line); } void printline(char * line) { printf("%s", line); }
...@@ -179,8 +179,8 @@ void find_export_symbols(char * filename) ...@@ -179,8 +179,8 @@ void find_export_symbols(char * filename)
perror(real_filename); perror(real_filename);
} }
while(fgets(line, MAXLINESZ, fp)) { while(fgets(line, MAXLINESZ, fp)) {
char *p; signed char *p;
char *e; signed char *e;
if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) || if (((p = strstr(line, "EXPORT_SYMBOL_GPL")) != 0) ||
((p = strstr(line, "EXPORT_SYMBOL")) != 0)) { ((p = strstr(line, "EXPORT_SYMBOL")) != 0)) {
/* Skip EXPORT_SYMBOL{_GPL} */ /* Skip EXPORT_SYMBOL{_GPL} */
...@@ -253,7 +253,7 @@ void extfunc(char * filename) { docfunctions(filename, FUNCTION); } ...@@ -253,7 +253,7 @@ void extfunc(char * filename) { docfunctions(filename, FUNCTION); }
* Call kernel-doc with the following parameters: * Call kernel-doc with the following parameters:
* kernel-doc -docbook -function function1 [-function function2] * kernel-doc -docbook -function function1 [-function function2]
*/ */
void singfunc(char * filename, char * line) void singfunc(char * filename, signed char * line)
{ {
char *vec[200]; /* Enough for specific functions */ char *vec[200]; /* Enough for specific functions */
int i, idx = 0; int i, idx = 0;
...@@ -290,7 +290,7 @@ void singfunc(char * filename, char * line) ...@@ -290,7 +290,7 @@ void singfunc(char * filename, char * line)
void parse_file(FILE *infile) void parse_file(FILE *infile)
{ {
char line[MAXLINESZ]; char line[MAXLINESZ];
char * s; signed char * s;
while(fgets(line, MAXLINESZ, infile)) { while(fgets(line, MAXLINESZ, infile)) {
if (line[0] == '!') { if (line[0] == '!') {
s = line + 2; s = line + 2;
......
...@@ -217,12 +217,12 @@ void use_config(char *m, int slen) ...@@ -217,12 +217,12 @@ void use_config(char *m, int slen)
printf(" $(wildcard include/config/%s.h) \\\n", s); printf(" $(wildcard include/config/%s.h) \\\n", s);
} }
void parse_config_file(char *map, size_t len) void parse_config_file(signed char *map, size_t len)
{ {
int *end = (int *) (map + len); int *end = (int *) (map + len);
/* start at +1, so that p can never be < map */ /* start at +1, so that p can never be < map */
int *m = (int *) map + 1; int *m = (int *) map + 1;
char *p, *q; signed char *p, *q;
for (; m < end; m++) { for (; m < end; m++) {
if (*m == INT_CONF) { p = (char *) m ; goto conf; } if (*m == INT_CONF) { p = (char *) m ; goto conf; }
...@@ -291,9 +291,9 @@ void do_config_file(char *filename) ...@@ -291,9 +291,9 @@ void do_config_file(char *filename)
void parse_dep_file(void *map, size_t len) void parse_dep_file(void *map, size_t len)
{ {
char *m = map; signed char *m = map;
char *end = m + len; signed char *end = m + len;
char *p; signed char *p;
char s[PATH_MAX]; char s[PATH_MAX];
p = strchr(m, ':'); p = strchr(m, ':');
......
...@@ -104,7 +104,7 @@ int main(int argc, const char * argv []) ...@@ -104,7 +104,7 @@ int main(int argc, const char * argv [])
/* Read config lines. */ /* Read config lines. */
while (fgets(line, buffer_size, fp_config)) while (fgets(line, buffer_size, fp_config))
{ {
const char * str_config; const signed char * str_config;
int is_same; int is_same;
int itarget; int itarget;
......
...@@ -33,7 +33,7 @@ void usage(char *argv0) ...@@ -33,7 +33,7 @@ void usage(char *argv0)
int getunicode(char **p0) int getunicode(char **p0)
{ {
char *p = *p0; unsigned char *p = *p0;
while (*p == ' ' || *p == '\t') while (*p == ' ' || *p == '\t')
p++; p++;
......
...@@ -31,14 +31,14 @@ char *defconfig_file; ...@@ -31,14 +31,14 @@ char *defconfig_file;
static int indent = 1; static int indent = 1;
static int valid_stdin = 1; static int valid_stdin = 1;
static int conf_cnt; static int conf_cnt;
static char line[128]; static signed char line[128];
static struct menu *rootEntry; static struct menu *rootEntry;
static char nohelp_text[] = "Sorry, no help available for this option yet.\n"; static char nohelp_text[] = "Sorry, no help available for this option yet.\n";
static void strip(char *str) static void strip(signed char *str)
{ {
char *p = str; signed char *p = str;
int l; int l;
while ((isspace(*p))) while ((isspace(*p)))
......
...@@ -27,10 +27,10 @@ const char *conf_confnames[] = { ...@@ -27,10 +27,10 @@ const char *conf_confnames[] = {
NULL, NULL,
}; };
static char *conf_expand_value(const char *in) static char *conf_expand_value(const signed char *in)
{ {
struct symbol *sym; struct symbol *sym;
const char *src; const signed char *src;
static char res_value[SYMBOL_MAXLENGTH]; static char res_value[SYMBOL_MAXLENGTH];
char *dst, name[SYMBOL_MAXLENGTH]; char *dst, name[SYMBOL_MAXLENGTH];
...@@ -295,7 +295,7 @@ int conf_write(const char *name) ...@@ -295,7 +295,7 @@ int conf_write(const char *name)
} else } else
basename = conf_def_filename; basename = conf_def_filename;
sprintf(newname, "%s.tmpconfig.%d", dirname, getpid()); sprintf(newname, "%s.tmpconfig.%d", dirname, (int)getpid());
out = fopen(newname, "w"); out = fopen(newname, "w");
if (!out) if (!out)
return 1; return 1;
......
...@@ -82,8 +82,8 @@ save_config_help[] = ...@@ -82,8 +82,8 @@ save_config_help[] =
"leave this blank.\n" "leave this blank.\n"
; ;
static char buf[4096], *bufptr = buf; static signed char buf[4096], *bufptr = buf;
static char input_buf[4096]; static signed char input_buf[4096];
static char filename[PATH_MAX+1] = ".config"; static char filename[PATH_MAX+1] = ".config";
static char *args[1024], **argptr = args; static char *args[1024], **argptr = args;
static int indent; static int indent;
......
...@@ -421,7 +421,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym) ...@@ -421,7 +421,7 @@ tristate sym_toggle_tristate_value(struct symbol *sym)
bool sym_string_valid(struct symbol *sym, const char *str) bool sym_string_valid(struct symbol *sym, const char *str)
{ {
char ch; signed char ch;
switch (sym->type) { switch (sym->type) {
case S_STRING: case S_STRING:
......
...@@ -12,16 +12,21 @@ ...@@ -12,16 +12,21 @@
#include "modpost.h" #include "modpost.h"
/* We use the ELF typedefs, since we can't rely on stdint.h being present. */ /* We use the ELF typedefs for kernel_ulong_t but bite the bullet and
* use either stdint.h or inttypes.h for the rest. */
#if KERNEL_ELFCLASS == ELFCLASS32 #if KERNEL_ELFCLASS == ELFCLASS32
typedef Elf32_Addr kernel_ulong_t; typedef Elf32_Addr kernel_ulong_t;
#else #else
typedef Elf64_Addr kernel_ulong_t; typedef Elf64_Addr kernel_ulong_t;
#endif #endif
#ifdef __sun__
#include <inttypes.h>
#else
#include <stdint.h>
#endif
typedef Elf32_Word __u32; typedef uint32_t __u32;
typedef Elf32_Half __u16; typedef uint16_t __u16;
typedef unsigned char __u8; typedef unsigned char __u8;
/* Big exception to the "don't include kernel headers into userspace, which /* Big exception to the "don't include kernel headers into userspace, which
......
...@@ -219,7 +219,7 @@ get_next_line(unsigned long *pos, void *file, unsigned long size) ...@@ -219,7 +219,7 @@ get_next_line(unsigned long *pos, void *file, unsigned long size)
static char line[4096]; static char line[4096];
int skip = 1; int skip = 1;
size_t len = 0; size_t len = 0;
char *p = (char *)file + *pos; signed char *p = (char *)file + *pos;
char *s = line; char *s = line;
for (; *pos < size ; (*pos)++) for (; *pos < size ; (*pos)++)
......
...@@ -252,9 +252,9 @@ static int parse_comment(const char *file, unsigned long len) ...@@ -252,9 +252,9 @@ static int parse_comment(const char *file, unsigned long len)
} }
/* FIXME: Handle .s files differently (eg. # starts comments) --RR */ /* FIXME: Handle .s files differently (eg. # starts comments) --RR */
static int parse_file(const char *fname, struct md4_ctx *md) static int parse_file(const signed char *fname, struct md4_ctx *md)
{ {
char *file; signed char *file;
unsigned long i, len; unsigned long i, len;
file = grab_file(fname, &len); file = grab_file(fname, &len);
...@@ -332,7 +332,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md) ...@@ -332,7 +332,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
Sum all files in the same dir or subdirs. Sum all files in the same dir or subdirs.
*/ */
while ((line = get_next_line(&pos, file, flen)) != NULL) { while ((line = get_next_line(&pos, file, flen)) != NULL) {
char* p = line; signed char* p = line;
if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) { if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) {
check_files = 1; check_files = 1;
continue; continue;
...@@ -456,7 +456,7 @@ static void write_version(const char *filename, const char *sum, ...@@ -456,7 +456,7 @@ static void write_version(const char *filename, const char *sum,
close(fd); close(fd);
} }
static int strip_rcs_crap(char *version) static int strip_rcs_crap(signed char *version)
{ {
unsigned int len, full_len; unsigned int len, full_len;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment