Static checking by Sun C 5.12.

* lib-src/etags.c (analyse_regex): Omit unreachable code.
* src/alloc.c (buffer_memory_full) [REL_ALLOC]:
* src/bytecode.c (exec_byte_code):
* src/dispnew.c (init_display):
* src/eval.c (error):
* src/fileio.c (Fsubstitute_in_file_name):
* src/keyboard.c (Fevent_convert_list):
* src/keymap.c (Fsingle_key_description):
* src/term.c (maybe_fatal, fatal):
* src/xfns.c (Fx_display_backing_store, Fx_display_visual_class):
* src/xsmfns.c (Fhandle_save_session):
Omit unreachable code.
* src/keymap.c (map_keymap_char_table_item): Cast void * to
a function pointer type; the C Standard requires this.
This commit is contained in:
Paul Eggert 2013-03-13 00:27:34 -07:00
parent 2c3f72f4b5
commit d9df6f40e3
13 changed files with 27 additions and 29 deletions

View file

@ -1,5 +1,8 @@
2013-03-13 Paul Eggert <eggert@cs.ucla.edu> 2013-03-13 Paul Eggert <eggert@cs.ucla.edu>
Static checking by Sun C 5.12.
* etags.c (analyse_regex): Omit unreachable code.
* movemail.c (main): Call umask on all systems. * movemail.c (main): Call umask on all systems.
This is OK since Emacs already assumes umask elsewhere. This is OK since Emacs already assumes umask elsewhere.
Don't grant more read permissions than necessary. Don't grant more read permissions than necessary.

View file

@ -5628,10 +5628,7 @@ analyse_regex (char *regex_arg)
/* regexfile is a file containing regexps, one per line. */ /* regexfile is a file containing regexps, one per line. */
regexfp = fopen (regexfile, "r"); regexfp = fopen (regexfile, "r");
if (regexfp == NULL) if (regexfp == NULL)
{ pfatal (regexfile);
pfatal (regexfile);
return;
}
linebuffer_init (&regexbuf); linebuffer_init (&regexbuf);
while (readline_internal (&regexbuf, regexfp) > 0) while (readline_internal (&regexbuf, regexfp) > 0)
analyse_regex (regexbuf.buffer); analyse_regex (regexbuf.buffer);

View file

@ -1,5 +1,20 @@
2013-03-13 Paul Eggert <eggert@cs.ucla.edu> 2013-03-13 Paul Eggert <eggert@cs.ucla.edu>
Static checking by Sun C 5.12.
* alloc.c (buffer_memory_full) [REL_ALLOC]:
* bytecode.c (exec_byte_code):
* dispnew.c (init_display):
* eval.c (error):
* fileio.c (Fsubstitute_in_file_name):
* keyboard.c (Fevent_convert_list):
* keymap.c (Fsingle_key_description):
* term.c (maybe_fatal, fatal):
* xfns.c (Fx_display_backing_store, Fx_display_visual_class):
* xsmfns.c (Fhandle_save_session):
Omit unreachable code.
* keymap.c (map_keymap_char_table_item): Cast void * to
a function pointer type; the C Standard requires this.
* sysdep.c: Remove a use of BSD_SYSTEM, which I'm trying to phase out. * sysdep.c: Remove a use of BSD_SYSTEM, which I'm trying to phase out.
Include <sys/param.h> unconditionally, as that works elsewhere and Include <sys/param.h> unconditionally, as that works elsewhere and
is simpler here. Include <sys/sysctl.h> if DARWIN_OS || is simpler here. Include <sys/sysctl.h> if DARWIN_OS ||

View file

@ -422,11 +422,11 @@ buffer_memory_full (ptrdiff_t nbytes)
#ifndef REL_ALLOC #ifndef REL_ALLOC
memory_full (nbytes); memory_full (nbytes);
#endif #else
/* This used to call error, but if we've run out of memory, we could /* This used to call error, but if we've run out of memory, we could
get infinite recursion trying to build the string. */ get infinite recursion trying to build the string. */
xsignal (Qnil, Vmemory_signal_data); xsignal (Qnil, Vmemory_signal_data);
#endif
} }
/* A common multiple of the positive integers A and B. Ideally this /* A common multiple of the positive integers A and B. Ideally this

View file

@ -755,7 +755,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
{ {
BEFORE_POTENTIAL_GC (); BEFORE_POTENTIAL_GC ();
wrong_type_argument (Qlistp, v1); wrong_type_argument (Qlistp, v1);
AFTER_POTENTIAL_GC ();
} }
NEXT; NEXT;
} }
@ -790,7 +789,6 @@ exec_byte_code (Lisp_Object bytestr, Lisp_Object vector, Lisp_Object maxdepth,
{ {
BEFORE_POTENTIAL_GC (); BEFORE_POTENTIAL_GC ();
wrong_type_argument (Qlistp, v1); wrong_type_argument (Qlistp, v1);
AFTER_POTENTIAL_GC ();
} }
NEXT; NEXT;
} }

View file

@ -6100,10 +6100,7 @@ init_display (void)
/* If no window system has been specified, try to use the terminal. */ /* If no window system has been specified, try to use the terminal. */
if (! isatty (0)) if (! isatty (0))
{ fatal ("standard input is not a tty");
fatal ("standard input is not a tty");
exit (1);
}
#ifdef WINDOWSNT #ifdef WINDOWSNT
terminal_type = "w32console"; terminal_type = "w32console";

View file

@ -1690,7 +1690,6 @@ error (const char *m, ...)
va_list ap; va_list ap;
va_start (ap, m); va_start (ap, m);
verror (m, ap); verror (m, ap);
va_end (ap);
} }
DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0, DEFUN ("commandp", Fcommandp, Scommandp, 1, 2, 0,

View file

@ -1850,9 +1850,6 @@ those `/' is discarded. */)
error ("Missing \"}\" in environment-variable substitution"); error ("Missing \"}\" in environment-variable substitution");
badvar: badvar:
error ("Substituting nonexistent environment variable \"%s\"", target); error ("Substituting nonexistent environment variable \"%s\"", target);
/* NOTREACHED */
return Qnil;
} }
/* A slightly faster and more convenient way to get /* A slightly faster and more convenient way to get
@ -3305,7 +3302,6 @@ Use the current time if TIMESTAMP is nil. TIMESTAMP is in the format of
return Qnil; return Qnil;
#endif #endif
report_file_error ("Setting file times", Fcons (absname, Qnil)); report_file_error ("Setting file times", Fcons (absname, Qnil));
return Qnil;
} }
} }

View file

@ -6552,10 +6552,7 @@ has the same base event type and all the specified modifiers. */)
else if (SYMBOLP (base)) else if (SYMBOLP (base))
return apply_modifiers (modifiers, base); return apply_modifiers (modifiers, base);
else else
{ error ("Invalid base event");
error ("Invalid base event");
return Qnil;
}
} }
/* Try to recognize SYMBOL as a modifier name. /* Try to recognize SYMBOL as a modifier name.

View file

@ -565,7 +565,8 @@ map_keymap_char_table_item (Lisp_Object args, Lisp_Object key, Lisp_Object val)
{ {
if (!NILP (val)) if (!NILP (val))
{ {
map_keymap_function_t fun = XSAVE_POINTER (args, 0); map_keymap_function_t fun
= (map_keymap_function_t) XSAVE_POINTER (args, 0);
/* If the key is a range, make a copy since map_char_table modifies /* If the key is a range, make a copy since map_char_table modifies
it in place. */ it in place. */
if (CONSP (key)) if (CONSP (key))
@ -2310,7 +2311,6 @@ around function keys and event symbols. */)
return Fcopy_sequence (key); return Fcopy_sequence (key);
else else
error ("KEY must be an integer, cons, symbol, or string"); error ("KEY must be an integer, cons, symbol, or string");
return Qnil;
} }
static char * static char *

View file

@ -3426,9 +3426,6 @@ maybe_fatal (int must_succeed, struct terminal *terminal,
vfatal (str2, ap); vfatal (str2, ap);
else else
verror (str1, ap); verror (str1, ap);
va_end (ap);
emacs_abort ();
} }
void void
@ -3437,7 +3434,6 @@ fatal (const char *str, ...)
va_list ap; va_list ap;
va_start (ap, str); va_start (ap, str);
vfatal (str, ap); vfatal (str, ap);
va_end (ap);
} }

View file

@ -3769,7 +3769,6 @@ If omitted or nil, that stands for the selected frame's display. */)
default: default:
error ("Strange value for BackingStore parameter of screen"); error ("Strange value for BackingStore parameter of screen");
result = Qnil;
} }
return result; return result;
@ -3811,7 +3810,6 @@ If omitted or nil, that stands for the selected frame's display. */)
break; break;
default: default:
error ("Display has an unknown visual class"); error ("Display has an unknown visual class");
result = Qnil;
} }
return result; return result;

View file

@ -514,9 +514,11 @@ Do not call this function yourself. */)
prevent. Fix this in next version. */ prevent. Fix this in next version. */
Fkill_emacs (Qnil); Fkill_emacs (Qnil);
#if 0
/* This will not be reached, but we want kill-emacs-hook to be run. */ /* This will not be reached, but we want kill-emacs-hook to be run. */
SmcCloseConnection (smc_conn, 0, 0); SmcCloseConnection (smc_conn, 0, 0);
ice_connection_closed (); ice_connection_closed ();
#endif
} }
return Qnil; return Qnil;