From 74141cfa2393677b737d7dcbcaac2e5dff387b71 Mon Sep 17 00:00:00 2001 From: kvigor Date: Wed, 16 May 2001 21:29:08 +0000 Subject: [PATCH] clean up a bunch of compiler warnings git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@823 4a8a32a2-be11-0410-ad9d-d568d2c75423 --- support/cpp/cpperror.c | 2 +- support/cpp/cppexp.c | 6 +-- support/cpp/cpphash.c | 4 +- support/cpp/cpphash.h | 1 - support/cpp/cpplib.c | 85 ++++++++++++------------------------------ support/cpp/cpplib.h | 2 +- 6 files changed, 30 insertions(+), 70 deletions(-) diff --git a/support/cpp/cpperror.c b/support/cpp/cpperror.c index 13d5ae55..088d11eb 100644 --- a/support/cpp/cpperror.c +++ b/support/cpp/cpperror.c @@ -69,7 +69,7 @@ cpp_print_containing_files ( fprintf (stderr, ",\n "); } - fprintf (stderr, " from %s:%d", ip->nominal_fname, line); + fprintf (stderr, " from %s:%ld", ip->nominal_fname, line); } if (! first) fprintf (stderr, ":\n"); diff --git a/support/cpp/cppexp.c b/support/cpp/cppexp.c index 51e8e8e2..b6331c73 100644 --- a/support/cpp/cppexp.c +++ b/support/cpp/cppexp.c @@ -32,8 +32,8 @@ Written by Per Bothner 1994. */ //extern char *xmalloc PARAMS ((unsigned)); //extern char *xrealloc PARAMS ((char *, unsigned)); -#ifdef MULTIBYTE_CHARS #include +#ifdef MULTIBYTE_CHARS #include #endif @@ -335,7 +335,7 @@ cpp_reader *pfile) It is mostly copied from c-lex.c. */ { register int result = 0; - register num_chars = 0; + register int num_chars = 0; unsigned width = MAX_CHAR_TYPE_SIZE; int wide_flag = 0; int max_chars; @@ -672,7 +672,7 @@ cpp_parse_expr ( struct operation *stack = init_stack; struct operation *limit = stack + INIT_STACK_SIZE; register struct operation *top = stack; - int lprio, rprio; + int lprio, rprio = 0; top->rprio = 0; top->flags = 0; diff --git a/support/cpp/cpphash.c b/support/cpp/cpphash.c index d9a3dca1..410a404b 100644 --- a/support/cpp/cpphash.c +++ b/support/cpp/cpphash.c @@ -28,10 +28,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "newalloc.h" -#if defined(_MSC_VER) #include #include -#endif /* Define a generic NULL if one hasn't already been defined. */ @@ -44,6 +42,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define volatile #endif +static HASHNODE *hashtab[HASHSIZE]; + /* * return hash function on name. must be compatible with the one * computed a step at a time, elsewhere diff --git a/support/cpp/cpphash.h b/support/cpp/cpphash.h index 914a12f5..d0a0de31 100644 --- a/support/cpp/cpphash.h +++ b/support/cpp/cpphash.h @@ -31,7 +31,6 @@ typedef struct hashnode HASHNODE; politeness, for use when speed isn't so important. */ #define HASHSIZE 1403 -static HASHNODE *hashtab[HASHSIZE]; #define HASHSTEP(old, c) ((old << 2) + c) #define MAKE_POS(v) (v & 0x7fffffff) /* make number positive */ diff --git a/support/cpp/cpplib.c b/support/cpp/cpplib.c index 4f71d82b..19ee1dc2 100644 --- a/support/cpp/cpplib.c +++ b/support/cpp/cpplib.c @@ -87,6 +87,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #endif + // PENDING: Straighten this out into configure #ifdef __MINGW32__ #include @@ -279,30 +280,21 @@ struct cpp_pending { static void add_import (); static void append_include_chain (); -static void make_undef (); static void make_assertion (); static void path_include (); static void initialize_builtins (); static void initialize_char_syntax (); -static void dump_arg_n (); -static void dump_defn_1 (); extern void delete_macro (); -static void trigraph_pcp (); static int finclude (); static void validate_else (); static int comp_def_part (); extern void fancy_abort (); -static void pipe_closed (); -static void print_containing_files (); static int lookup_import (); static int redundant_include_p (); -static is_system_include (); +static int is_system_include (cpp_reader *, char *); static struct file_name_map *read_name_map (); static char *read_filename_string (); static int open_include_file (); -static int check_preconditions (); -static void pcfinclude (); -static void pcstring_used (); static int check_macro_name (); static int compare_defs (); static int compare_token_lists (); @@ -874,40 +866,6 @@ file_cleanup ( return 0; } -static void -newline_fix ( - cpp_reader *pfile) -{ -#if 1 - NEWLINE_FIX; -#else - register U_CHAR *p = bp; - - /* First count the backslash-newline pairs here. */ - - while (p[0] == '\\' && p[1] == '\n') - p += 2; - - /* What follows the backslash-newlines is not embarrassing. */ - - if (*p != '/' && *p != '*') - return; - - /* Copy all potentially embarrassing characters - that follow the backslash-newline pairs - down to where the pairs originally started. */ - - while (*p == '*' || *p == '/') - *bp++ = *p++; - - /* Now write the same number of pairs after the embarrassing chars. */ - while (bp < p) { - *bp++ = '\\'; - *bp++ = '\n'; - } -#endif -} - /* Assuming we have read '/'. If this is the start of a comment (followed by '*' or '/'), skip to the end of the comment, and return ' '. @@ -1080,7 +1038,7 @@ handle_directive ( { int c; register struct directive *kt; int ident_length; - long after_ident; + long after_ident = 0; U_CHAR *ident, *line_end; long old_written = CPP_WRITTEN (pfile); @@ -2188,7 +2146,7 @@ output_line_command ( CPP_PUTS_Q (pfile, sharp_line, sizeof(sharp_line)-1); } - sprintf (CPP_PWRITTEN (pfile), "%d ", line+2); + sprintf (CPP_PWRITTEN (pfile), "%ld ", line+2); CPP_ADJUST_WRITTEN (pfile, strlen (CPP_PWRITTEN (pfile))); // modification for SDC51 @@ -2228,8 +2186,8 @@ macarg ( int rest_args) { int paren = 0; - enum cpp_token token; - long arg_start = CPP_WRITTEN (pfile); + enum cpp_token token = CPP_EOF; + /* long arg_start = CPP_WRITTEN (pfile); */ char save_put_out_comments = CPP_OPTIONS (pfile)->put_out_comments; CPP_OPTIONS (pfile)->put_out_comments = 0; @@ -2449,7 +2407,7 @@ special_symbol ( adjust_position (CPP_LINE_BASE (ip), ip->cur, &line, &col); buf = (char *) alloca (10); - sprintf (buf, "%d", line); + sprintf (buf, "%ld", line); } break; @@ -2478,7 +2436,7 @@ special_symbol ( if (!is_idstart[*ip->cur]) goto oops; - if (hp = cpp_lookup (pfile, ip->cur, -1, -1)) + if ((hp = cpp_lookup (pfile, ip->cur, -1, -1)) != 0) { #if 0 if (pcp_outfile && pcp_inside_if @@ -2710,7 +2668,7 @@ macroexpand ( if (nargs >= 0) { - enum cpp_token token; + enum cpp_token token = CPP_EOF; args = (struct argdata *) alloca ((nargs + 1) * sizeof (struct argdata)); @@ -3175,10 +3133,8 @@ do_include ( int f; /* file number */ - int retried = 0; /* Have already tried macro - expanding the include line*/ int angle_brackets = 0; /* 0 for "...", 1 for <...> */ - int pcf = -1; + /* int pcf = -1; */ char *pcfbuf; /* char *pcfbuflimit;*/ int pcfnum; @@ -4336,7 +4292,6 @@ skip_if_group ( int any) { int c; - int at_beg_of_line = 1; struct directive *kt; IF_STACK_FRAME *save_if_stack = pfile->if_stack; /* don't pop past here */ #if 0 @@ -4634,7 +4589,7 @@ cpp_get_token ( cpp_reader *pfile) { register int c, c2, c3; - long old_written; + long old_written = 0; long start_line, start_column; enum cpp_token token; struct cpp_options *opts = CPP_OPTIONS (pfile); @@ -5635,7 +5590,7 @@ finclude ( long i; int length; cpp_buffer *fp; /* For input stack frame */ - int missing_newline = 0; + /* int missing_newline = 0; # KILL */ if (file_size_and_mode (f, &st_mode, &st_size) < 0) { @@ -6636,11 +6591,17 @@ cpp_handle_options ( char *p; if (argv[i][2] != 0) + { p = argv[i] + 2; - else if (i + 1 == argc) - fatal ("Assertion missing after -A option"); - else - p = argv[++i]; + } + else + { + if (++i == argc) + { + fatal ("Assertion missing after -A option"); + } + p = argv[i]; + } if (!strcmp (p, "-")) { struct cpp_pending **ptr; @@ -7118,7 +7079,7 @@ read_token_list ( { struct arglist *temp; long name_written = CPP_WRITTEN (pfile); - int eofp = 0; int c; + int c; cpp_skip_hspace (pfile); diff --git a/support/cpp/cpplib.h b/support/cpp/cpplib.h index 7787f7d8..dd5f7a01 100644 --- a/support/cpp/cpplib.h +++ b/support/cpp/cpplib.h @@ -649,7 +649,7 @@ extern cpp_hashnode* cpp_lookup PARAMS ((cpp_reader*, const U_CHAR*, /* Define the MS VC6 stuff - Some of these should also be defined for the other hosts but they are here until declared safe for all */ -#if defined(_MSC_VER) +#if 1 // defined(_MSC_VER) void init_parse_file (cpp_reader *pfile) ; -- 2.30.2