aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorPaul Eggert2011-02-25 21:54:36 -0800
committerPaul Eggert2011-02-25 21:54:36 -0800
commitae3f8fbfc330c91272411720263bd9eb0c5bb82a (patch)
treeb5b475176540b655a3478f157c8d445f0f63a7a8 /lib-src
parent61e9662ef52e9b4a257fc9dd3c3812af2657f70a (diff)
parent9e1b7fe6be807a6081988aa2834b9489110d9ded (diff)
downloademacs-ae3f8fbfc330c91272411720263bd9eb0c5bb82a.tar.gz
emacs-ae3f8fbfc330c91272411720263bd9eb0c5bb82a.zip
Merge: lib-src changes mostly to avoid GCC warnings
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/ChangeLog46
-rw-r--r--lib-src/ebrowse.c71
-rw-r--r--lib-src/emacsclient.c92
-rw-r--r--lib-src/etags.c2
-rw-r--r--lib-src/fakemail.c13
-rw-r--r--lib-src/make-docfile.c15
6 files changed, 143 insertions, 96 deletions
diff --git a/lib-src/ChangeLog b/lib-src/ChangeLog
index 2c98cdf59a6..ba77a92cf17 100644
--- a/lib-src/ChangeLog
+++ b/lib-src/ChangeLog
@@ -1,3 +1,49 @@
12011-02-26 Paul Eggert <eggert@cs.ucla.edu>
2
3 * ebrowse.c (parse_qualified_param_ident_or_type): Make it clear
4 to reader (and to the compiler) that the loop always executes at
5 least once. This prevents a warning with recent GCC.
6 (BROWSE_STRUCT): Remove unused macro.
7
8 * fakemail.c: Include <ignore-value.h>.
9 (put_line): Explicitly ignore fwrite return value, for benefit of
10 recent glibc + gcc.
11 (close_the_streams): Diagnose output errors instead of merely
12 exiting with nonzero status.
13 (my_fclose, main): Diagnose input errors, and exit with nonzero status.
14 Formerly, input errors were silently ignored.
15
16 * ebrowse.c (putstr): Rename from PUTSTR and turn into a function.
17 All callers changed. This is cleaner, and avoids GCC warnings about
18 passing NULL to fputs.
19 (insert_keyword): Rename parameter to avoid shadowing diagnostic.
20
212011-02-25 Paul Eggert <eggert@cs.ucla.edu>
22
23 * emacsclient.c (main): Avoid dangling 'if'.
24 (xstrdup): Remove; no longer needed.
25 (get_current_dir_name, w32_getenv, get_server_config, find_tty):
26 (set_local_socket, main):
27 Use const char *, not char *, for pointers that are not assigned
28 through.
29 (IF_LINT): New macro.
30 (set_local_socket, main): Use it to suppress warnings with
31 GCC -Wuninitialized.
32
33 * emacsclient.c: Redo local variables to avoid shadowing problems.
34 (message, socket_status, start_daemon_and_retry_set_socket):
35 Rename locals.
36 (main): Move decl of "i".
37
38 * etags.c (ISUPPER): Move to inside the only #ifdef where it's used.
39 This avoids an unused-macro warning with some GCC settings.
40
41 * make-docfile.c (write_globals): Change char * to char const *
42 to avoid a GCC "assignment discards qualifiers" diagnostic
43 in some configurations.
44 (scan_c_file): Refactor local variable decls to make their scope
45 more accurate and to avoid a GCC -Wuninitialized diagnostic.
46
12011-02-22 Eli Zaretskii <eliz@gnu.org> 472011-02-22 Eli Zaretskii <eliz@gnu.org>
2 48
3 * etags.c (canonicalize_filename, ISUPPER): Fix last change. 49 * etags.c (canonicalize_filename, ISUPPER): Fix last change.
diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c
index f2894d5a0c2..113b6fdfe40 100644
--- a/lib-src/ebrowse.c
+++ b/lib-src/ebrowse.c
@@ -77,7 +77,6 @@ along with GNU Emacs. If not, see <http://www.gnu.org/licenses/>. */
77#define TREE_HEADER_STRUCT "[ebrowse-hs " 77#define TREE_HEADER_STRUCT "[ebrowse-hs "
78#define TREE_STRUCT "[ebrowse-ts " 78#define TREE_STRUCT "[ebrowse-ts "
79#define MEMBER_STRUCT "[ebrowse-ms " 79#define MEMBER_STRUCT "[ebrowse-ms "
80#define BROWSE_STRUCT "[ebrowse-bs "
81#define CLASS_STRUCT "[ebrowse-cs " 80#define CLASS_STRUCT "[ebrowse-cs "
82 81
83/* The name of the symbol table entry for global functions, variables, 82/* The name of the symbol table entry for global functions, variables,
@@ -1108,22 +1107,23 @@ leave_namespace (void)
1108/* Write string S to the output file FP in a Lisp-readable form. 1107/* Write string S to the output file FP in a Lisp-readable form.
1109 If S is null, write out `()'. */ 1108 If S is null, write out `()'. */
1110 1109
1111#define PUTSTR(s, fp) \ 1110static inline void
1112 do { \ 1111putstr (const char *s, FILE *fp)
1113 if (!s) \ 1112{
1114 { \ 1113 if (!s)
1115 putc ('(', fp); \ 1114 {
1116 putc (')', fp); \ 1115 putc ('(', fp);
1117 putc (' ', fp); \ 1116 putc (')', fp);
1118 } \ 1117 putc (' ', fp);
1119 else \ 1118 }
1120 { \ 1119 else
1121 putc ('"', fp); \ 1120 {
1122 fputs (s, fp); \ 1121 putc ('"', fp);
1123 putc ('"', fp); \ 1122 fputs (s, fp);
1124 putc (' ', fp); \ 1123 putc ('"', fp);
1125 } \ 1124 putc (' ', fp);
1126 } while (0) 1125 }
1126}
1127 1127
1128/* A dynamically allocated buffer for constructing a scope name. */ 1128/* A dynamically allocated buffer for constructing a scope name. */
1129 1129
@@ -1216,16 +1216,16 @@ dump_members (FILE *fp, struct member *m)
1216 for (n = 0; m; m = m->next, ++n) 1216 for (n = 0; m; m = m->next, ++n)
1217 { 1217 {
1218 fputs (MEMBER_STRUCT, fp); 1218 fputs (MEMBER_STRUCT, fp);
1219 PUTSTR (m->name, fp); 1219 putstr (m->name, fp);
1220 PUTSTR (NULL, fp); /* FIXME? scope for globals */ 1220 putstr (NULL, fp); /* FIXME? scope for globals */
1221 fprintf (fp, "%u ", (unsigned) m->flags); 1221 fprintf (fp, "%u ", (unsigned) m->flags);
1222 PUTSTR (m->filename, fp); 1222 putstr (m->filename, fp);
1223 PUTSTR (m->regexp, fp); 1223 putstr (m->regexp, fp);
1224 fprintf (fp, "%u ", (unsigned) m->pos); 1224 fprintf (fp, "%u ", (unsigned) m->pos);
1225 fprintf (fp, "%u ", (unsigned) m->vis); 1225 fprintf (fp, "%u ", (unsigned) m->vis);
1226 putc (' ', fp); 1226 putc (' ', fp);
1227 PUTSTR (m->def_filename, fp); 1227 putstr (m->def_filename, fp);
1228 PUTSTR (m->def_regexp, fp); 1228 putstr (m->def_regexp, fp);
1229 fprintf (fp, "%u", (unsigned) m->def_pos); 1229 fprintf (fp, "%u", (unsigned) m->def_pos);
1230 putc (']', fp); 1230 putc (']', fp);
1231 putc ('\n', fp); 1231 putc ('\n', fp);
@@ -1243,20 +1243,20 @@ static void
1243dump_sym (FILE *fp, struct sym *root) 1243dump_sym (FILE *fp, struct sym *root)
1244{ 1244{
1245 fputs (CLASS_STRUCT, fp); 1245 fputs (CLASS_STRUCT, fp);
1246 PUTSTR (root->name, fp); 1246 putstr (root->name, fp);
1247 1247
1248 /* Print scope, if any. */ 1248 /* Print scope, if any. */
1249 if (root->namesp) 1249 if (root->namesp)
1250 PUTSTR (sym_scope (root), fp); 1250 putstr (sym_scope (root), fp);
1251 else 1251 else
1252 PUTSTR (NULL, fp); 1252 putstr (NULL, fp);
1253 1253
1254 /* Print flags. */ 1254 /* Print flags. */
1255 fprintf (fp, "%u", root->flags); 1255 fprintf (fp, "%u", root->flags);
1256 PUTSTR (root->filename, fp); 1256 putstr (root->filename, fp);
1257 PUTSTR (root->regexp, fp); 1257 putstr (root->regexp, fp);
1258 fprintf (fp, "%u", (unsigned) root->pos); 1258 fprintf (fp, "%u", (unsigned) root->pos);
1259 PUTSTR (root->sfilename, fp); 1259 putstr (root->sfilename, fp);
1260 putc (']', fp); 1260 putc (']', fp);
1261 putc ('\n', fp); 1261 putc ('\n', fp);
1262} 1262}
@@ -1323,7 +1323,7 @@ dump_roots (FILE *fp)
1323 if (!f_append) 1323 if (!f_append)
1324 { 1324 {
1325 fputs (TREE_HEADER_STRUCT, fp); 1325 fputs (TREE_HEADER_STRUCT, fp);
1326 PUTSTR (EBROWSE_FILE_VERSION, fp); 1326 putstr (EBROWSE_FILE_VERSION, fp);
1327 1327
1328 putc ('\"', fp); 1328 putc ('\"', fp);
1329 if (!f_structs) 1329 if (!f_structs)
@@ -2062,11 +2062,11 @@ re_init_scanner (void)
2062} 2062}
2063 2063
2064 2064
2065/* Insert a keyword NAME with token value TK into the keyword hash 2065/* Insert a keyword NAME with token value TKV into the keyword hash
2066 table. */ 2066 table. */
2067 2067
2068static void 2068static void
2069insert_keyword (const char *name, int tk) 2069insert_keyword (const char *name, int tkv)
2070{ 2070{
2071 const char *s; 2071 const char *s;
2072 unsigned h = 0; 2072 unsigned h = 0;
@@ -2077,7 +2077,7 @@ insert_keyword (const char *name, int tk)
2077 2077
2078 h %= KEYWORD_TABLE_SIZE; 2078 h %= KEYWORD_TABLE_SIZE;
2079 k->name = name; 2079 k->name = name;
2080 k->tk = tk; 2080 k->tk = tkv;
2081 k->next = keyword_table[h]; 2081 k->next = keyword_table[h];
2082 keyword_table[h] = k; 2082 keyword_table[h] = k;
2083} 2083}
@@ -2951,7 +2951,9 @@ parse_qualified_param_ident_or_type (char **last_id)
2951 static char *id = NULL; 2951 static char *id = NULL;
2952 static int id_size = 0; 2952 static int id_size = 0;
2953 2953
2954 while (LOOKING_AT (IDENT)) 2954 assert (LOOKING_AT (IDENT));
2955
2956 do
2955 { 2957 {
2956 int len = strlen (yytext) + 1; 2958 int len = strlen (yytext) + 1;
2957 if (len > id_size) 2959 if (len > id_size)
@@ -2974,6 +2976,7 @@ parse_qualified_param_ident_or_type (char **last_id)
2974 else 2976 else
2975 break; 2977 break;
2976 } 2978 }
2979 while (LOOKING_AT (IDENT));
2977} 2980}
2978 2981
2979 2982
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 8d5f0482637..251f35873e3 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -112,6 +112,13 @@ char *(getcwd) (char *, size_t);
112/* Additional space when allocating buffers for filenames, etc. */ 112/* Additional space when allocating buffers for filenames, etc. */
113#define EXTRA_SPACE 100 113#define EXTRA_SPACE 100
114 114
115/* Use this to suppress gcc's `...may be used before initialized' warnings. */
116#ifdef lint
117# define IF_LINT(Code) Code
118#else
119# define IF_LINT(Code) /* empty */
120#endif
121
115 122
116/* Name used to invoke this program. */ 123/* Name used to invoke this program. */
117const char *progname; 124const char *progname;
@@ -190,20 +197,6 @@ xmalloc (unsigned int size)
190 return result; 197 return result;
191} 198}
192 199
193/* Like strdup but get a fatal error if memory is exhausted. */
194
195static char *
196xstrdup (const char *s)
197{
198 char *result = strdup (s);
199 if (result == NULL)
200 {
201 perror ("strdup");
202 exit (EXIT_FAILURE);
203 }
204 return result;
205}
206
207/* From sysdep.c */ 200/* From sysdep.c */
208#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME) 201#if !defined (HAVE_GET_CURRENT_DIR_NAME) || defined (BROKEN_GET_CURRENT_DIR_NAME)
209 202
@@ -233,7 +226,7 @@ char*
233get_current_dir_name (void) 226get_current_dir_name (void)
234{ 227{
235 char *buf; 228 char *buf;
236 char *pwd; 229 const char *pwd;
237 struct stat dotstat, pwdstat; 230 struct stat dotstat, pwdstat;
238 /* If PWD is accurate, use it instead of calling getwd. PWD is 231 /* If PWD is accurate, use it instead of calling getwd. PWD is
239 sometimes a nicer name, and using it may avoid a fatal error if a 232 sometimes a nicer name, and using it may avoid a fatal error if a
@@ -353,7 +346,7 @@ w32_getenv (char *envvar)
353 { 346 {
354 /* "w32console" is what Emacs on Windows uses for tty-type under -nw. */ 347 /* "w32console" is what Emacs on Windows uses for tty-type under -nw. */
355 if (strcmp (envvar, "TERM") == 0) 348 if (strcmp (envvar, "TERM") == 0)
356 return xstrdup ("w32console"); 349 return "w32console";
357 /* Found neither in the environment nor in the registry. */ 350 /* Found neither in the environment nor in the registry. */
358 return NULL; 351 return NULL;
359 } 352 }
@@ -474,13 +467,13 @@ ttyname (int fd)
474/* Display a normal or error message. 467/* Display a normal or error message.
475 On Windows, use a message box if compiled as a Windows app. */ 468 On Windows, use a message box if compiled as a Windows app. */
476static void 469static void
477message (int is_error, const char *message, ...) 470message (int is_error, const char *format, ...)
478{ 471{
479 char msg[2048]; 472 char msg[2048];
480 va_list args; 473 va_list args;
481 474
482 va_start (args, message); 475 va_start (args, format);
483 vsprintf (msg, message, args); 476 vsprintf (msg, format, args);
484 va_end (args); 477 va_end (args);
485 478
486#ifdef WINDOWSNT 479#ifdef WINDOWSNT
@@ -918,7 +911,7 @@ get_server_config (struct sockaddr_in *server, char *authentication)
918 config = fopen (server_file, "rb"); 911 config = fopen (server_file, "rb");
919 else 912 else
920 { 913 {
921 char *home = egetenv ("HOME"); 914 const char *home = egetenv ("HOME");
922 915
923 if (home) 916 if (home)
924 { 917 {
@@ -1025,10 +1018,10 @@ strprefix (const char *prefix, const char *string)
1025 is zero, or return 0 if NOABORT is non-zero. */ 1018 is zero, or return 0 if NOABORT is non-zero. */
1026 1019
1027static int 1020static int
1028find_tty (char **tty_type, char **tty_name, int noabort) 1021find_tty (const char **tty_type, const char **tty_name, int noabort)
1029{ 1022{
1030 char *type = egetenv ("TERM"); 1023 const char *type = egetenv ("TERM");
1031 char *name = ttyname (fileno (stdout)); 1024 const char *name = ttyname (fileno (stdout));
1032 1025
1033 if (!name) 1026 if (!name)
1034 { 1027 {
@@ -1080,11 +1073,11 @@ find_tty (char **tty_type, char **tty_name, int noabort)
1080 0 - success: none of the above */ 1073 0 - success: none of the above */
1081 1074
1082static int 1075static int
1083socket_status (char *socket_name) 1076socket_status (char *name)
1084{ 1077{
1085 struct stat statbfr; 1078 struct stat statbfr;
1086 1079
1087 if (stat (socket_name, &statbfr) == -1) 1080 if (stat (name, &statbfr) == -1)
1088 return 2; 1081 return 2;
1089 1082
1090 if (statbfr.st_uid != geteuid ()) 1083 if (statbfr.st_uid != geteuid ())
@@ -1205,7 +1198,7 @@ set_local_socket (void)
1205 int default_sock = !socket_name; 1198 int default_sock = !socket_name;
1206 int saved_errno = 0; 1199 int saved_errno = 0;
1207 const char *server_name = "server"; 1200 const char *server_name = "server";
1208 const char *tmpdir; 1201 const char *tmpdir IF_LINT ( = NULL);
1209 1202
1210 if (socket_name && !strchr (socket_name, '/') 1203 if (socket_name && !strchr (socket_name, '/')
1211 && !strchr (socket_name, '\\')) 1204 && !strchr (socket_name, '\\'))
@@ -1260,10 +1253,10 @@ set_local_socket (void)
1260 associated with the name. This is reminiscent of the logic 1253 associated with the name. This is reminiscent of the logic
1261 that init_editfns uses to set the global Vuser_full_name. */ 1254 that init_editfns uses to set the global Vuser_full_name. */
1262 1255
1263 char *user_name = (char *) egetenv ("LOGNAME"); 1256 const char *user_name = egetenv ("LOGNAME");
1264 1257
1265 if (!user_name) 1258 if (!user_name)
1266 user_name = (char *) egetenv ("USER"); 1259 user_name = egetenv ("USER");
1267 1260
1268 if (user_name) 1261 if (user_name)
1269 { 1262 {
@@ -1483,8 +1476,8 @@ start_daemon_and_retry_set_socket (void)
1483 else 1476 else
1484 { 1477 {
1485 char emacs[] = "emacs"; 1478 char emacs[] = "emacs";
1486 char daemon[] = "--daemon"; 1479 char daemon_option[] = "--daemon";
1487 char *d_argv[] = {emacs, daemon, 0 }; 1480 char *d_argv[] = {emacs, daemon_option, 0 };
1488 if (socket_name != NULL) 1481 if (socket_name != NULL)
1489 { 1482 {
1490 /* Pass --daemon=socket_name as argument. */ 1483 /* Pass --daemon=socket_name as argument. */
@@ -1504,10 +1497,12 @@ start_daemon_and_retry_set_socket (void)
1504int 1497int
1505main (int argc, char **argv) 1498main (int argc, char **argv)
1506{ 1499{
1507 int i, rl, needlf = 0; 1500 int rl, needlf = 0;
1508 char *cwd, *str; 1501 char *cwd, *str;
1509 char string[BUFSIZ+1]; 1502 char string[BUFSIZ+1];
1510 int null_socket_name, null_server_file, start_daemon_if_needed; 1503 int null_socket_name IF_LINT ( = 0);
1504 int null_server_file IF_LINT ( = 0);
1505 int start_daemon_if_needed;
1511 int exit_status = EXIT_SUCCESS; 1506 int exit_status = EXIT_SUCCESS;
1512 1507
1513 main_argv = argv; 1508 main_argv = argv;
@@ -1543,21 +1538,21 @@ main (int argc, char **argv)
1543 null_server_file = (server_file == NULL); 1538 null_server_file = (server_file == NULL);
1544 } 1539 }
1545 1540
1546 if ((emacs_socket = set_socket (alternate_editor 1541 emacs_socket = set_socket (alternate_editor || start_daemon_if_needed);
1547 || start_daemon_if_needed)) == INVALID_SOCKET) 1542 if (emacs_socket == INVALID_SOCKET)
1548 if (start_daemon_if_needed) 1543 {
1549 { 1544 if (! start_daemon_if_needed)
1550 /* Reset socket_name and server_file if they were NULL 1545 fail ();
1551 before the set_socket call. */ 1546
1552 if (null_socket_name) 1547 /* Reset socket_name and server_file if they were NULL
1553 socket_name = NULL; 1548 before the set_socket call. */
1554 if (null_server_file) 1549 if (null_socket_name)
1555 server_file = NULL; 1550 socket_name = NULL;
1556 1551 if (null_server_file)
1557 start_daemon_and_retry_set_socket (); 1552 server_file = NULL;
1558 } 1553
1559 else 1554 start_daemon_and_retry_set_socket ();
1560 fail (); 1555 }
1561 1556
1562 cwd = get_current_dir_name (); 1557 cwd = get_current_dir_name ();
1563 if (cwd == 0) 1558 if (cwd == 0)
@@ -1615,7 +1610,7 @@ main (int argc, char **argv)
1615 frame is available. */ 1610 frame is available. */
1616 if (tty || (current_frame && !eval)) 1611 if (tty || (current_frame && !eval))
1617 { 1612 {
1618 char *tty_type, *tty_name; 1613 const char *tty_type, *tty_name;
1619 1614
1620 if (find_tty (&tty_type, &tty_name, !tty)) 1615 if (find_tty (&tty_type, &tty_name, !tty))
1621 { 1616 {
@@ -1635,6 +1630,7 @@ main (int argc, char **argv)
1635 1630
1636 if ((argc - optind > 0)) 1631 if ((argc - optind > 0))
1637 { 1632 {
1633 int i;
1638 for (i = optind; i < argc; i++) 1634 for (i = optind; i < argc; i++)
1639 { 1635 {
1640 1636
diff --git a/lib-src/etags.c b/lib-src/etags.c
index b738f0f4564..385e4cc9721 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -236,7 +236,6 @@ If you want regular expression support, you should delete this notice and
236#define ISALNUM(c) isalnum (CHAR(c)) 236#define ISALNUM(c) isalnum (CHAR(c))
237#define ISALPHA(c) isalpha (CHAR(c)) 237#define ISALPHA(c) isalpha (CHAR(c))
238#define ISDIGIT(c) isdigit (CHAR(c)) 238#define ISDIGIT(c) isdigit (CHAR(c))
239#define ISUPPER(c) isupper (CHAR(c))
240#define ISLOWER(c) islower (CHAR(c)) 239#define ISLOWER(c) islower (CHAR(c))
241 240
242#define lowcase(c) tolower (CHAR(c)) 241#define lowcase(c) tolower (CHAR(c))
@@ -6648,6 +6647,7 @@ canonicalize_filename (register char *fn)
6648 6647
6649#ifdef DOS_NT 6648#ifdef DOS_NT
6650 /* Canonicalize drive letter case. */ 6649 /* Canonicalize drive letter case. */
6650# define ISUPPER(c) isupper (CHAR(c))
6651 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0])) 6651 if (fn[0] != '\0' && fn[1] == ':' && ISUPPER (fn[0]))
6652 fn[0] = lowcase (fn[0]); 6652 fn[0] = lowcase (fn[0]);
6653 6653
diff --git a/lib-src/fakemail.c b/lib-src/fakemail.c
index 26375a61654..780a104b405 100644
--- a/lib-src/fakemail.c
+++ b/lib-src/fakemail.c
@@ -62,6 +62,8 @@ main ()
62 62
63/* This is to declare cuserid. */ 63/* This is to declare cuserid. */
64#include <unistd.h> 64#include <unistd.h>
65
66#include <ignore-value.h>
65 67
66/* Type definitions */ 68/* Type definitions */
67 69
@@ -405,8 +407,8 @@ close_the_streams (void)
405 for (rem = the_streams; 407 for (rem = the_streams;
406 rem != ((stream_list) NULL); 408 rem != ((stream_list) NULL);
407 rem = rem->rest_streams) 409 rem = rem->rest_streams)
408 no_problems = (no_problems && 410 if (no_problems && (*rem->action) (rem->handle) != 0)
409 ((*rem->action) (rem->handle) == 0)); 411 error ("output error", NULL);
410 the_streams = ((stream_list) NULL); 412 the_streams = ((stream_list) NULL);
411 return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE); 413 return (no_problems ? EXIT_SUCCESS : EXIT_FAILURE);
412} 414}
@@ -427,6 +429,8 @@ my_fclose (FILE *the_file)
427{ 429{
428 putc ('\n', the_file); 430 putc ('\n', the_file);
429 fflush (the_file); 431 fflush (the_file);
432 if (ferror (the_file))
433 return EOF;
430 return fclose (the_file); 434 return fclose (the_file);
431} 435}
432 436
@@ -496,7 +500,7 @@ put_line (const char *string)
496 } 500 }
497 } 501 }
498 /* Output that much, then break the line. */ 502 /* Output that much, then break the line. */
499 fwrite (s, 1, breakpos - s, rem->handle); 503 ignore_value (fwrite (s, 1, breakpos - s, rem->handle));
500 column = 8; 504 column = 8;
501 505
502 /* Skip whitespace and prepare to print more addresses. */ 506 /* Skip whitespace and prepare to print more addresses. */
@@ -729,6 +733,9 @@ main (int argc, char **argv)
729 put_string (buf); 733 put_string (buf);
730 } 734 }
731 735
736 if (no_problems && (ferror (stdin) || fclose (stdin) != 0))
737 error ("input error", NULL);
738
732 exit (close_the_streams ()); 739 exit (close_the_streams ());
733} 740}
734 741
diff --git a/lib-src/make-docfile.c b/lib-src/make-docfile.c
index f0aa222986a..f900ea42e91 100644
--- a/lib-src/make-docfile.c
+++ b/lib-src/make-docfile.c
@@ -617,7 +617,7 @@ write_globals (void)
617 qsort (globals, num_globals, sizeof (struct global), compare_globals); 617 qsort (globals, num_globals, sizeof (struct global), compare_globals);
618 for (i = 0; i < num_globals; ++i) 618 for (i = 0; i < num_globals; ++i)
619 { 619 {
620 char *type; 620 char const *type;
621 621
622 switch (globals[i].type) 622 switch (globals[i].type)
623 { 623 {
@@ -658,12 +658,8 @@ scan_c_file (char *filename, const char *mode)
658 FILE *infile; 658 FILE *infile;
659 register int c; 659 register int c;
660 register int commas; 660 register int commas;
661 register int defunflag;
662 register int defvarperbufferflag;
663 register int defvarflag;
664 int minargs, maxargs; 661 int minargs, maxargs;
665 int extension = filename[strlen (filename) - 1]; 662 int extension = filename[strlen (filename) - 1];
666 enum global_type type;
667 663
668 if (extension == 'o') 664 if (extension == 'o')
669 filename[strlen (filename) - 1] = 'c'; 665 filename[strlen (filename) - 1] = 'c';
@@ -693,6 +689,10 @@ scan_c_file (char *filename, const char *mode)
693 while (!feof (infile)) 689 while (!feof (infile))
694 { 690 {
695 int doc_keyword = 0; 691 int doc_keyword = 0;
692 int defunflag = 0;
693 int defvarperbufferflag = 0;
694 int defvarflag = 0;
695 enum global_type type = INVALID;
696 696
697 if (c != '\n' && c != '\r') 697 if (c != '\n' && c != '\r')
698 { 698 {
@@ -726,7 +726,6 @@ scan_c_file (char *filename, const char *mode)
726 continue; 726 continue;
727 727
728 defvarflag = 1; 728 defvarflag = 1;
729 defunflag = 0;
730 729
731 c = getc (infile); 730 c = getc (infile);
732 defvarperbufferflag = (c == 'P'); 731 defvarperbufferflag = (c == 'P');
@@ -738,8 +737,6 @@ scan_c_file (char *filename, const char *mode)
738 type = LISP_OBJECT; 737 type = LISP_OBJECT;
739 else if (c == 'B') 738 else if (c == 'B')
740 type = BOOLEAN; 739 type = BOOLEAN;
741 else
742 type = INVALID;
743 } 740 }
744 741
745 c = getc (infile); 742 c = getc (infile);
@@ -758,8 +755,6 @@ scan_c_file (char *filename, const char *mode)
758 continue; 755 continue;
759 c = getc (infile); 756 c = getc (infile);
760 defunflag = c == 'U'; 757 defunflag = c == 'U';
761 defvarflag = 0;
762 defvarperbufferflag = 0;
763 } 758 }
764 else continue; 759 else continue;
765 760