]> code.delx.au - gnu-emacs/blobdiff - lib-src/make-docfile.c
Use 'inline', not 'INLINE'.
[gnu-emacs] / lib-src / make-docfile.c
index 956e85f163a9fc3f0ae9719507e5847775d3d3a4..ba54202954b09e9ecd3e2e6292cf12389cd973cb 100644 (file)
@@ -66,6 +66,13 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define IS_DIRECTORY_SEP(_c_) ((_c_) == DIRECTORY_SEP)
 #endif
 
+/* Use this to suppress gcc's `...may be used before initialized' warnings. */
+#ifdef lint
+# define IF_LINT(Code) Code
+#else
+# define IF_LINT(Code) /* empty */
+#endif
+
 static int scan_file (char *filename);
 static int scan_lisp_file (const char *filename, const char *mode);
 static int scan_c_file (char *filename, const char *mode);
@@ -255,7 +262,7 @@ start_globals (void)
   fprintf (outfile, "struct emacs_globals {\n");
 }
 \f
-static char buf[128];
+static char input_buffer[128];
 
 /* Some state during the execution of `read_c_string_or_comment'.  */
 struct rcsoc_state
@@ -284,7 +291,7 @@ struct rcsoc_state
 /* Output CH to the file or buffer in STATE.  Any pending newlines or
    spaces are output first.  */
 
-static INLINE void
+static inline void
 put_char (int ch, struct rcsoc_state *state)
 {
   int out_ch;
@@ -395,7 +402,7 @@ read_c_string_or_comment (FILE *infile, int printflag, int comment, int *saw_usa
   struct rcsoc_state state;
 
   state.in_file = infile;
-  state.buf_ptr = (printflag < 0 ? buf : 0);
+  state.buf_ptr = (printflag < 0 ? input_buffer : 0);
   state.out_file = (printflag > 0 ? outfile : 0);
   state.pending_spaces = 0;
   state.pending_newlines = 0;
@@ -481,7 +488,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
 {
   register char *p;
   int in_ident = 0;
-  char *ident_start;
+  char *ident_start IF_LINT (= NULL);
   size_t ident_length = 0;
 
   fprintf (out, "(fn");
@@ -617,7 +624,7 @@ write_globals (void)
   qsort (globals, num_globals, sizeof (struct global), compare_globals);
   for (i = 0; i < num_globals; ++i)
     {
-      char *type;
+      char const *type;
 
       switch (globals[i].type)
        {
@@ -658,12 +665,8 @@ scan_c_file (char *filename, const char *mode)
   FILE *infile;
   register int c;
   register int commas;
-  register int defunflag;
-  register int defvarperbufferflag;
-  register int defvarflag;
   int minargs, maxargs;
   int extension = filename[strlen (filename) - 1];
-  enum global_type type;
 
   if (extension == 'o')
     filename[strlen (filename) - 1] = 'c';
@@ -693,6 +696,10 @@ scan_c_file (char *filename, const char *mode)
   while (!feof (infile))
     {
       int doc_keyword = 0;
+      int defunflag = 0;
+      int defvarperbufferflag = 0;
+      int defvarflag = 0;
+      enum global_type type = INVALID;
 
       if (c != '\n' && c != '\r')
        {
@@ -726,7 +733,6 @@ scan_c_file (char *filename, const char *mode)
            continue;
 
          defvarflag = 1;
-         defunflag = 0;
 
          c = getc (infile);
          defvarperbufferflag = (c == 'P');
@@ -738,8 +744,6 @@ scan_c_file (char *filename, const char *mode)
                type = LISP_OBJECT;
              else if (c == 'B')
                type = BOOLEAN;
-             else
-               type = INVALID;
            }
 
          c = getc (infile);
@@ -758,8 +762,6 @@ scan_c_file (char *filename, const char *mode)
            continue;
          c = getc (infile);
          defunflag = c == 'U';
-         defvarflag = 0;
-         defvarperbufferflag = 0;
        }
       else continue;
 
@@ -795,15 +797,15 @@ scan_c_file (char *filename, const char *mode)
          /* Read in the identifier.  */
          do
            {
-             buf[i++] = c;
+             input_buffer[i++] = c;
              c = getc (infile);
            }
          while (! (c == ',' || c == ' ' || c == '\t' ||
                    c == '\n' || c == '\r'));
-         buf[i] = '\0';
+         input_buffer[i] = '\0';
 
          name = xmalloc (i + 1);
-         memcpy (name, buf, i + 1);
+         memcpy (name, input_buffer, i + 1);
          add_global (type, name);
          continue;
        }
@@ -888,7 +890,7 @@ scan_c_file (char *filename, const char *mode)
 
          putc (037, outfile);
          putc (defvarflag ? 'V' : 'F', outfile);
-         fprintf (outfile, "%s\n", buf);
+         fprintf (outfile, "%s\n", input_buffer);
 
          if (comment)
            getc (infile);      /* Skip past `*' */
@@ -931,11 +933,12 @@ scan_c_file (char *filename, const char *mode)
              *p = '\0';
              /* Output them.  */
              fprintf (outfile, "\n\n");
-             write_c_args (outfile, buf, argbuf, minargs, maxargs);
+             write_c_args (outfile, input_buffer, argbuf, minargs, maxargs);
            }
          else if (defunflag && maxargs == -1 && !saw_usage)
            /* The DOC should provide the usage form.  */
-           fprintf (stderr, "Missing `usage' for function `%s'.\n", buf);
+           fprintf (stderr, "Missing `usage' for function `%s'.\n",
+                    input_buffer);
        }
     }
  eof: