clean up a bunch of compiler warnings
authorkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 16 May 2001 21:29:08 +0000 (21:29 +0000)
committerkvigor <kvigor@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 16 May 2001 21:29:08 +0000 (21:29 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@823 4a8a32a2-be11-0410-ad9d-d568d2c75423

support/cpp/cpperror.c
support/cpp/cppexp.c
support/cpp/cpphash.c
support/cpp/cpphash.h
support/cpp/cpplib.c
support/cpp/cpplib.h

index 13d5ae559b6190837396522c497a71830f13975b..088d11ebad4dff2e3bfa2b68779882ed8de618db 100644 (file)
@@ -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");
index 51e8e8e2fe21279042bf28a354302c0fa90a8b66..b6331c73d50f5d162b64447801e31d65bf03583e 100644 (file)
@@ -32,8 +32,8 @@ Written by Per Bothner 1994. */
 //extern char *xmalloc PARAMS ((unsigned));
 //extern char *xrealloc PARAMS ((char *, unsigned));
 
-#ifdef MULTIBYTE_CHARS
 #include <stdlib.h>
+#ifdef MULTIBYTE_CHARS
 #include <locale.h>
 #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;
index d9a3dca1f8b6a6ff8d56e59c318877b90b8b0a60..410a404b77379c4bcce8023067e9ec7ba9c8b279 100644 (file)
@@ -28,10 +28,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 
 #include "newalloc.h"
 
-#if defined(_MSC_VER)
 #include <string.h>
 #include <stdlib.h>
-#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
index 914a12f5b011a2df553f942366d19ab97e6a93f9..d0a0de314accaf2b754b95ac50411961cd4756e6 100644 (file)
@@ -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 */
 
index 4f71d82b1adbdc3155b890449a05b35e8e0f34bb..19ee1dc2c1b12612299376e5a5e9d7b3a6dca495 100644 (file)
@@ -87,6 +87,7 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
 #include <stdlib.h>
 #endif
 
+
 // PENDING: Straighten this out into configure
 #ifdef __MINGW32__
 #include <time.h>
@@ -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);
 
index 7787f7d84d20005398c7fdf1d04e1a6c958e7294..dd5f7a013e128cd5c349dc8c8fc19fed6fc501cd 100644 (file)
@@ -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) ;