OSDN Git Service

* config/h8300/h8300.c (h8300_adjust_insn_length): Clean up.
[pf3gnuchains/gcc-fork.git] / gcc / protoize.c
index 92b4b51..f8d8a9e 100644 (file)
@@ -1,6 +1,6 @@
 /* Protoize program - Original version by Ron Guilmette (rfg@segfault.us.com).
    Copyright (C) 1989, 1992, 1993, 1994, 1995, 1996, 1997, 1998,
-   1999, 2000 Free Software Foundation, Inc.
+   1999, 2000, 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GCC.
 
@@ -167,8 +167,8 @@ static char * syscalls_absolute_filename;
 /* Type of the structure that holds information about macro unexpansions.  */
 
 struct unexpansion_struct {
-  const char *expanded;
-  const char *contracted;
+  const char *const expanded;
+  const char *const contracted;
 };
 typedef struct unexpansion_struct unexpansion;
 
@@ -205,9 +205,9 @@ static const int hash_mask = (HASH_TABLE_SIZE - 1);
 #define LOCAL_INCLUDE_DIR "/usr/local/include"
 #endif
 
-struct default_include { const char *fname; 
-                        const char *component;
-                        int x1, x2; } include_defaults[]
+static const struct default_include { const char *const fname; 
+                        const char *const component;
+                        const int x1, x2; } include_defaults[]
 #ifdef INCLUDE_DEFAULTS
   = INCLUDE_DEFAULTS;
 #else
@@ -564,19 +564,11 @@ static char * saved_repl_write_ptr;
 static void
 notice VPARAMS ((const char *msgid, ...))
 {
-#ifndef ANSI_PROTOTYPES
-  const char *msgid;
-#endif
-  va_list ap;
-
-  VA_START (ap, msgid);
-
-#ifndef ANSI_PROTOTYPES
-  msgid = va_arg (ap, const char *);
-#endif
+  VA_OPEN (ap, msgid);
+  VA_FIXEDARG (ap, const char *, msgid);
 
   vfprintf (stderr, _(msgid), ap);
-  va_end (ap);
+  VA_CLOSE (ap);
 }
 
 \f
@@ -663,7 +655,7 @@ safe_read (desc, ptr, len)
       }
     if (nchars == 0)
       break;
-    /* Arithmetic on void pointers is a gcc extention.  */
+    /* Arithmetic on void pointers is a gcc extension.  */
     ptr = (char *) ptr + nchars;
     left -= nchars;
   }
@@ -693,7 +685,7 @@ safe_write (desc, ptr, len, out_fname)
                pname, shortpath (NULL, out_fname), xstrerror (errno_val));
        return;
       }
-    /* Arithmetic on void pointers is a gcc extention.  */
+    /* Arithmetic on void pointers is a gcc extension.  */
     ptr = (char *) ptr + written;
     len -= written;
   }
@@ -724,7 +716,7 @@ static int
 is_id_char (ch)
      int ch;
 {
-  return (ISALNUM (ch) || (ch == '_') || (ch == '$'));
+  return (ISIDNUM (ch) || (ch == '$'));
 }
 
 /* Give a message indicating the proper way to invoke this program and then
@@ -751,7 +743,7 @@ static int
 in_system_include_dir (path)
      const char *path;
 {
-  struct default_include *p;
+  const struct default_include *p;
 
   if (! is_abspath (path))
     abort ();          /* Must be an absolutized filename.  */
@@ -1143,7 +1135,7 @@ unexpand_if_needed (aux_info_line)
               strcpy (copy_p, unexp_p->contracted);
               copy_p += size;
 
-              /* Assume the there will not be another replacement required
+              /* Assume that there will not be another replacement required
                  within the text just replaced.  */
 
               s += len;
@@ -1203,7 +1195,7 @@ abspath (cwd, rel_filename)
      const char *rel_filename;
 {
   /* Setup the current working directory as needed.  */
-  const char *cwd2 = (cwd) ? cwd : cwd_buffer;
+  const char *const cwd2 = (cwd) ? cwd : cwd_buffer;
   char *const abs_buffer
     = (char *) alloca (strlen (cwd2) + strlen (rel_filename) + 2);
   char *endp = abs_buffer;
@@ -2475,20 +2467,20 @@ reverse_def_dec_list (hp)
 {
   file_info *file_p = hp->fip;
   def_dec_info *prev = NULL;
-  def_dec_info *current = (def_dec_info *)file_p->defs_decs;
+  def_dec_info *current = (def_dec_info *) file_p->defs_decs;
 
   if (!current)
     return;                    /* no list to reverse */
 
   prev = current;
-  if (! (current = (def_dec_info *)current->next_in_file))
+  if (! (current = (def_dec_info *) current->next_in_file))
     return;                    /* can't reverse a single list element */
 
   prev->next_in_file = NULL;
 
   while (current)
     {
-      def_dec_info *next = (def_dec_info *)current->next_in_file;
+      def_dec_info *next = (def_dec_info *) current->next_in_file;
 
       current->next_in_file = prev;
       prev = current;
@@ -2546,7 +2538,7 @@ find_extern_def (head, user)
      code being converted contains its own definition of a function which
      could have been supplied by libc.a.  In such cases, we should avoid
      issuing the normal warning, and defer to the definition given in the
-     user's own code.   */
+     user's own code.  */
 
   for (dd_p = head; dd_p; dd_p = dd_p->next_for_func)
     if (dd_p->is_func_def && !dd_p->is_static)
@@ -2833,7 +2825,7 @@ connect_defs_and_decs (hp)
       for (dd_p2 = dd_p->next_for_func; dd_p2; dd_p2 = dd_p2->next_for_func)
         if (!dd_p2->is_func_def && dd_p2->is_static
          && !dd_p2->definition && (dd_p2->file == dd_p->file))
-          ((NONCONST def_dec_info *)dd_p2)->definition = dd_p->definition;
+          ((NONCONST def_dec_info *) dd_p2)->definition = dd_p->definition;
       }
 
   /* Convert any dummy (-1) definitions we created in the step above back to
@@ -3468,7 +3460,7 @@ find_rightmost_formals_list (clean_text_p)
          by an alphabetic character, while others *cannot* validly be followed
          by such characters.  */
 
-      if ((ch == '{') || ISALPHA ((unsigned char)ch))
+      if ((ch == '{') || ISALPHA ((unsigned char) ch))
         break;
 
       /* At this point, we have found a right paren, but we know that it is
@@ -3653,7 +3645,7 @@ add_global_decls (file_p, clean_text_p)
   /* Now write out full prototypes for all of the things that had been
      implicitly declared in this file (but only those for which we were
      actually able to find unique matching definitions).  Avoid duplicates
-     by marking things that we write out as we go.   */
+     by marking things that we write out as we go.  */
 
   {
     int some_decls_added = 0;
@@ -3814,7 +3806,7 @@ edit_fn_definition (def_dec_p, clean_text_p)
             have_newlines |= (*scan_orig == '\n');
             /* Leave identical whitespace alone.  */
             if (!ISSPACE ((const unsigned char)*scan_orig))
-              *((NONCONST char *)scan_orig) = ' '; /* identical - so whiteout */
+              *((NONCONST char *) scan_orig) = ' '; /* identical - so whiteout */
           }
         else
           have_flotsam = 1;
@@ -3885,7 +3877,7 @@ do_cleaning (new_clean_text_base, new_clean_text_limit)
             while (scan_p[1] != '\'' || scan_p[0] == '\\')
               {
                 if (scan_p[0] == '\\'
-                   && !ISSPACE ((const unsigned char)scan_p[1]))
+                   && !ISSPACE ((const unsigned char) scan_p[1]))
                   scan_p[1] = ' ';
                 if (!ISSPACE ((const unsigned char)*scan_p))
                   *scan_p = ' ';
@@ -3900,7 +3892,7 @@ do_cleaning (new_clean_text_base, new_clean_text_limit)
             while (scan_p[1] != '"' || scan_p[0] == '\\')
               {
                 if (scan_p[0] == '\\'
-                   && !ISSPACE ((const unsigned char)scan_p[1]))
+                   && !ISSPACE ((const unsigned char) scan_p[1]))
                   scan_p[1] = ' ';
                 if (!ISSPACE ((const unsigned char)*scan_p))
                   *scan_p = ' ';
@@ -4539,7 +4531,7 @@ do_processing ()
 #endif /* !defined (UNPROTOIZE) */
 }
 \f
-static struct option longopts[] =
+static const struct option longopts[] =
 {
   {"version", 0, 0, 'V'},
   {"file_name", 0, 0, 'p'},
@@ -4592,18 +4584,7 @@ main (argc, argv)
   signal (SIGCHLD, SIG_DFL);
 #endif
 
-/* LC_CTYPE determines the character set used by the terminal so it has be set
-   to output messages correctly.  */
-
-#ifdef HAVE_LC_MESSAGES
-  setlocale (LC_CTYPE, "");
-  setlocale (LC_MESSAGES, "");
-#else
-  setlocale (LC_ALL, "");
-#endif
-
-  (void) bindtextdomain (PACKAGE, localedir);
-  (void) textdomain (PACKAGE);
+  gcc_init_libintl ();
 
   cwd_buffer = getpwd ();
   if (!cwd_buffer)
@@ -4719,8 +4700,7 @@ main (argc, argv)
   {
     const char *cp;
 
-    for (cp = varargs_style_indicator;
-        ISALNUM ((const unsigned char)*cp) || *cp == '_'; cp++)
+    for (cp = varargs_style_indicator; ISIDNUM (*cp); cp++)
       continue;
     if (*cp != 0)
       varargs_style_indicator = savestring (varargs_style_indicator,