Move IF_LINT from lisp.h to conf_post.h
[bpt/emacs.git] / lib-src / make-docfile.c
index 2a5f028..dafb7c0 100644 (file)
@@ -1,6 +1,7 @@
 /* Generate doc-string file for GNU Emacs from source files.
-   Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2012
-                 Free Software Foundation, Inc.
+
+Copyright (C) 1985-1986, 1992-1994, 1997, 1999-2012
+  Free Software Foundation, Inc.
 
 This file is part of GNU Emacs.
 
@@ -35,22 +36,26 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 
 #include <config.h>
 
-/* Defined to be emacs_main, sys_fopen, etc. in config.h.  */
-#undef main
-#undef fopen
-#undef chdir
-
 #include <stdio.h>
-#include <stdlib.h>
+#include <stdlib.h>   /* config.h unconditionally includes this anyway */
 #ifdef MSDOS
 #include <fcntl.h>
 #endif /* MSDOS */
 #ifdef WINDOWSNT
+/* Defined to be sys_fopen in ms-w32.h, but only #ifdef emacs, so this
+   is really just insurance.  */
+#undef fopen
 #include <fcntl.h>
 #include <direct.h>
 #endif /* WINDOWSNT */
 
 #ifdef DOS_NT
+/* Defined to be sys_chdir in ms-w32.h, but only #ifdef emacs, so this
+   is really just insurance.
+
+   Similarly, msdos defines this as sys_chdir, but we're not linking with the
+   file where that function is defined.  */
+#undef chdir
 #define READ_TEXT "rt"
 #define READ_BINARY "rb"
 #else  /* not DOS_NT */
@@ -58,33 +63,12 @@ along with GNU Emacs.  If not, see <http://www.gnu.org/licenses/>.  */
 #define READ_BINARY "r"
 #endif /* not DOS_NT */
 
-#ifndef DIRECTORY_SEP
-#define DIRECTORY_SEP '/'
-#endif
-
-#ifndef IS_DIRECTORY_SEP
-#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);
 static void start_globals (void);
 static void write_globals (void);
 
-#ifdef MSDOS
-/* s/msdos.h defines this as sys_chdir, but we're not linking with the
-   file where that function is defined.  */
-#undef chdir
-#endif
-
 #include <unistd.h>
 
 /* Stdio stream for output to the DOC file.  */
@@ -541,7 +525,7 @@ write_c_args (FILE *out, char *func, char *buf, int minargs, int maxargs)
 
          /* In C code, `default' is a reserved word, so we spell it
             `defalt'; demangle that here.  */
-         if (ident_length == 6 && strncmp (ident_start, "defalt", 6) == 0)
+         if (ident_length == 6 && memcmp (ident_start, "defalt", 6) == 0)
            fprintf (out, "DEFAULT");
          else
            while (ident_length-- > 0)
@@ -693,7 +677,13 @@ write_globals (void)
 
       while (i + 1 < num_globals
             && !strcmp (globals[i].name, globals[i + 1].name))
-       ++i;
+       {
+         if (globals[i].type == FUNCTION
+             && globals[i].value != globals[i + 1].value)
+           error ("function '%s' defined twice with differing signatures",
+                  globals[i].name);
+         ++i;
+       }
     }
 
   if (!seen_defun)
@@ -747,7 +737,7 @@ scan_c_file (char *filename, const char *mode)
       int defvarperbufferflag = 0;
       int defvarflag = 0;
       enum global_type type = INVALID;
-      char *name;
+      char *name IF_LINT (= 0);
 
       if (c != '\n' && c != '\r')
        {