1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-15 10:30:25 -08:00

Omit IF_LINT code that no longer seems needed

Nowadays GCC is smarter, or the Emacs code has mutated, or both,
and now is as good a time as any to remove uses of IF_LINT that
now seem to be unnecessary.
* lib-src/emacsclient.c (set_local_socket):
* lib-src/movemail.c (main) [MAIL_USE_MAILLOCK && HAVE_TOUCHLOCK]:
* src/buffer.c (fix_start_end_in_overlays, fix_overlays_before):
* src/casefiddle.c (casify_region):
* src/charset.c (load_charset_map):
* src/coding.c (decode_coding_object, encode_coding_object):
* src/data.c (Fmake_variable_buffer_local, Fmake_local_variable)
(cons_to_unsigned, cons_to_signed):
* src/frame.c (make_frame, x_set_frame_parameters):
* src/keyboard.c (read_event_from_main_queue):
* src/regex.c (regex_compile):
* src/syntax.c (back_comment):
* src/window.c (Frecenter):
* src/xfaces.c (Fx_list_fonts):
Remove IF_LINT that no longer seems necessary.
* src/image.c (png_load_body, jpeg_load_body): Simplify use of IF_LINT.
* src/keyboard.c (read_char): Use IF_LINT (volatile) rather than
a pragma dance to pacify GCC -Wclobbered.
* src/xdisp.c (x_produce_glyphs): Rewrite to avoid need for IF_LINT.

* src/xterm.c (x_connection_closed): Now _Noreturn, which should
mean we do not need IF_LINT any more.
(x_io_error_quitter): Now _Noreturn.  Put an 'assume (false)’
at the end, to forestall warnings from older compilers.
This commit is contained in:
Paul Eggert 2016-05-30 16:09:25 -07:00
parent cb379cbb7f
commit 237244bbd5
16 changed files with 46 additions and 61 deletions

View file

@ -1195,7 +1195,7 @@ set_local_socket (const char *local_socket_name)
int use_tmpdir = 0;
int saved_errno;
const char *server_name = local_socket_name;
const char *tmpdir IF_LINT ( = NULL);
const char *tmpdir;
char *tmpdir_storage = NULL;
char *socket_name_storage = NULL;

View file

@ -338,7 +338,7 @@ main (int argc, char **argv)
int lockcount = 0;
int status = 0;
#if defined (MAIL_USE_MAILLOCK) && defined (HAVE_TOUCHLOCK)
time_t touched_lock IF_LINT (= 0);
time_t touched_lock;
#endif
if (setuid (getuid ()) < 0 || setregid (-1, real_gid) < 0)

View file

@ -3552,8 +3552,8 @@ void
fix_start_end_in_overlays (register ptrdiff_t start, register ptrdiff_t end)
{
Lisp_Object overlay;
struct Lisp_Overlay *before_list IF_LINT (= NULL);
struct Lisp_Overlay *after_list IF_LINT (= NULL);
struct Lisp_Overlay *before_list;
struct Lisp_Overlay *after_list;
/* These are either nil, indicating that before_list or after_list
should be assigned, or the cons cell the cdr of which should be
assigned. */
@ -3700,7 +3700,7 @@ fix_overlays_before (struct buffer *bp, ptrdiff_t prev, ptrdiff_t pos)
/* If parent is nil, replace overlays_before; otherwise, parent->next. */
struct Lisp_Overlay *tail = bp->overlays_before, *parent = NULL, *right_pair;
Lisp_Object tem;
ptrdiff_t end IF_LINT (= 0);
ptrdiff_t end;
/* After the insertion, the several overlays may be in incorrect
order. The possibility is that, in the list `overlays_before',

View file

@ -196,7 +196,7 @@ casify_region (enum case_action flag, Lisp_Object b, Lisp_Object e)
ptrdiff_t start_byte;
/* Position of first and last changes. */
ptrdiff_t first = -1, last IF_LINT (= 0);
ptrdiff_t first = -1, last;
ptrdiff_t opoint = PT;
ptrdiff_t opoint_byte = PT_BYTE;

View file

@ -240,7 +240,7 @@ struct charset_map_entries
static void
load_charset_map (struct charset *charset, struct charset_map_entries *entries, int n_entries, int control_flag)
{
Lisp_Object vec IF_LINT (= Qnil), table IF_LINT (= Qnil);
Lisp_Object vec, table IF_LINT (= Qnil);
unsigned max_code = CHARSET_MAX_CODE (charset);
bool ascii_compatible_p = charset->ascii_compatible_p;
int min_char, max_char, nonascii_min_char;

View file

@ -8015,12 +8015,12 @@ decode_coding_object (struct coding_system *coding,
Lisp_Object dst_object)
{
ptrdiff_t count = SPECPDL_INDEX ();
unsigned char *destination IF_LINT (= NULL);
ptrdiff_t dst_bytes IF_LINT (= 0);
unsigned char *destination;
ptrdiff_t dst_bytes;
ptrdiff_t chars = to - from;
ptrdiff_t bytes = to_byte - from_byte;
Lisp_Object attrs;
ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
ptrdiff_t saved_pt = -1, saved_pt_byte;
bool need_marker_adjustment = 0;
Lisp_Object old_deactivate_mark;
@ -8198,7 +8198,7 @@ encode_coding_object (struct coding_system *coding,
ptrdiff_t chars = to - from;
ptrdiff_t bytes = to_byte - from_byte;
Lisp_Object attrs;
ptrdiff_t saved_pt = -1, saved_pt_byte IF_LINT (= 0);
ptrdiff_t saved_pt = -1, saved_pt_byte;
bool need_marker_adjustment = 0;
bool kill_src_buffer = 0;
Lisp_Object old_deactivate_mark;

View file

@ -1614,8 +1614,8 @@ The function `default-value' gets the default value and `set-default' sets it.
{
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
bool forwarded IF_LINT (= 0);
union Lisp_Val_Fwd valcontents;
bool forwarded;
CHECK_SYMBOL (variable);
sym = XSYMBOL (variable);
@ -1692,8 +1692,8 @@ Instead, use `add-hook' and specify t for the LOCAL argument. */)
(Lisp_Object variable)
{
Lisp_Object tem;
bool forwarded IF_LINT (= 0);
union Lisp_Val_Fwd valcontents IF_LINT (= {LISP_INITIALLY_ZERO});
bool forwarded;
union Lisp_Val_Fwd valcontents;
struct Lisp_Symbol *sym;
struct Lisp_Buffer_Local_Value *blv = NULL;
@ -2458,7 +2458,7 @@ uintmax_t
cons_to_unsigned (Lisp_Object c, uintmax_t max)
{
bool valid = 0;
uintmax_t val IF_LINT (= 0);
uintmax_t val;
if (INTEGERP (c))
{
valid = 0 <= XINT (c);
@ -2511,7 +2511,7 @@ intmax_t
cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
{
bool valid = 0;
intmax_t val IF_LINT (= 0);
intmax_t val;
if (INTEGERP (c))
{
val = XINT (c);

View file

@ -609,7 +609,7 @@ make_frame (bool mini_p)
{
Lisp_Object frame;
struct frame *f;
struct window *rw, *mw IF_LINT (= NULL);
struct window *rw, *mw;
Lisp_Object root_window;
Lisp_Object mini_window;
@ -3089,7 +3089,7 @@ x_set_frame_parameters (struct frame *f, Lisp_Object alist)
/* If both of these parameters are present, it's more efficient to
set them both at once. So we wait until we've looked at the
entire list before we set them. */
int width IF_LINT (= 0), height IF_LINT (= 0);
int width, height;
bool width_change = false, height_change = false;
/* Same here. */

View file

@ -5895,12 +5895,13 @@ static bool
png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
{
Lisp_Object specified_file;
Lisp_Object specified_data;
/* IF_LINT (volatile) works around GCC bug 54561. */
Lisp_Object IF_LINT (volatile) specified_data;
FILE * IF_LINT (volatile) fp = NULL;
int x, y;
ptrdiff_t i;
png_struct *png_ptr;
png_info *info_ptr = NULL, *end_info = NULL;
FILE *fp = NULL;
png_byte sig[8];
png_byte *pixels = NULL;
png_byte **rows = NULL;
@ -5922,7 +5923,6 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
/* Find out what file to load. */
specified_file = image_spec_value (img->spec, QCfile, NULL);
specified_data = image_spec_value (img->spec, QCdata, NULL);
IF_LINT (Lisp_Object volatile specified_data_volatile = specified_data);
if (NILP (specified_data))
{
@ -6018,10 +6018,6 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c)
return 0;
}
/* Silence a bogus diagnostic; see GCC bug 54561. */
IF_LINT (fp = c->fp);
IF_LINT (specified_data = specified_data_volatile);
/* Read image info. */
if (!NILP (specified_data))
png_set_read_fn (png_ptr, &tbr, png_read_from_memory);
@ -6672,9 +6668,9 @@ jpeg_load_body (struct frame *f, struct image *img,
struct my_jpeg_error_mgr *mgr)
{
Lisp_Object specified_file;
Lisp_Object specified_data;
/* The 'volatile' silences a bogus diagnostic; see GCC bug 54561. */
FILE * IF_LINT (volatile) fp = NULL;
/* IF_LINT (volatile) works around GCC bug 54561. */
Lisp_Object IF_LINT (volatile) specified_data;
FILE *volatile fp = NULL;
JSAMPARRAY buffer;
int row_stride, x, y;
unsigned long *colors;
@ -6687,7 +6683,6 @@ jpeg_load_body (struct frame *f, struct image *img,
/* Open the JPEG file. */
specified_file = image_spec_value (img->spec, QCfile, NULL);
specified_data = image_spec_value (img->spec, QCdata, NULL);
IF_LINT (Lisp_Object volatile specified_data_volatile = specified_data);
if (NILP (specified_data))
{
@ -6751,9 +6746,6 @@ jpeg_load_body (struct frame *f, struct image *img,
return 0;
}
/* Silence a bogus diagnostic; see GCC bug 54561. */
IF_LINT (specified_data = specified_data_volatile);
/* Create the JPEG decompression object. Let it read from fp.
Read the JPEG image header. */
jpeg_CreateDecompress (&mgr->cinfo, JPEG_LIB_VERSION, sizeof *&mgr->cinfo);

View file

@ -2122,7 +2122,7 @@ read_event_from_main_queue (struct timespec *end_time,
{
Lisp_Object c = Qnil;
sys_jmp_buf save_jump;
KBOARD *kb IF_LINT (= NULL);
KBOARD *kb;
start:
@ -2280,11 +2280,6 @@ read_decoded_event_from_main_queue (struct timespec *end_time,
}
}
#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wclobbered"
#endif
/* Read a character from the keyboard; call the redisplay if needed. */
/* commandflag 0 means do not autosave, but do redisplay.
-1 means do not redisplay, but do autosave.
@ -2317,7 +2312,9 @@ read_char (int commandflag, Lisp_Object map,
Lisp_Object prev_event,
bool *used_mouse_menu, struct timespec *end_time)
{
Lisp_Object c;
/* IF_LINT (volatile) works around GCC bug 54561. */
Lisp_Object IF_LINT (volatile) c;
ptrdiff_t jmpcount;
sys_jmp_buf local_getcjmp;
sys_jmp_buf save_jump;
@ -3125,10 +3122,6 @@ read_char (int commandflag, Lisp_Object map,
return c;
}
#if 4 < __GNUC__ + (6 <= __GNUC_MINOR__)
# pragma GCC diagnostic pop
#endif
/* Record a key that came from a mouse menu.
Record it for echoing, for this-command-keys, and so on. */

View file

@ -2465,9 +2465,9 @@ regex_compile (const_re_char *pattern, size_t size, reg_syntax_t syntax,
/* These hold the values of p, pattern, and pend from the main
pattern when we have pushed into a subpattern. */
re_char *main_p IF_LINT (= NULL);
re_char *main_pattern IF_LINT (= NULL);
re_char *main_pend IF_LINT (= NULL);
re_char *main_p;
re_char *main_pattern;
re_char *main_pend;
#ifdef DEBUG
debug++;

View file

@ -708,7 +708,7 @@ back_comment (ptrdiff_t from, ptrdiff_t from_byte, ptrdiff_t stop,
ptrdiff_t comment_end = from;
ptrdiff_t comment_end_byte = from_byte;
ptrdiff_t comstart_pos = 0;
ptrdiff_t comstart_byte IF_LINT (= 0);
ptrdiff_t comstart_byte;
/* Place where the containing defun starts,
or 0 if we didn't come across it yet. */
ptrdiff_t defun_start = 0;

View file

@ -5693,7 +5693,7 @@ and redisplay normally--don't erase and redraw the frame. */)
struct buffer *buf = XBUFFER (w->contents);
bool center_p = false;
ptrdiff_t charpos, bytepos;
EMACS_INT iarg IF_LINT (= 0);
EMACS_INT iarg;
int this_scroll_margin;
if (buf != current_buffer)

View file

@ -27342,18 +27342,21 @@ x_produce_glyphs (struct it *it)
int leftmost, rightmost, lowest, highest;
int lbearing, rbearing;
int i, width, ascent, descent;
int c IF_LINT (= 0); /* cmp->glyph_len can't be zero; see Bug#8512 */
int c;
XChar2b char2b;
struct font_metrics *pcm;
ptrdiff_t pos;
for (glyph_len = cmp->glyph_len; glyph_len > 0; glyph_len--)
if ((c = COMPOSITION_GLYPH (cmp, glyph_len - 1)) != '\t')
break;
eassume (0 < glyph_len); /* See Bug#8512. */
do
c = COMPOSITION_GLYPH (cmp, --glyph_len);
while (c == '\t' && 0 < glyph_len);
bool right_padded = glyph_len < cmp->glyph_len;
for (i = 0; i < glyph_len; i++)
{
if ((c = COMPOSITION_GLYPH (cmp, i)) != '\t')
c = COMPOSITION_GLYPH (cmp, i);
if (c != '\t')
break;
cmp->offsets[i * 2] = cmp->offsets[i * 2 + 1] = 0;
}

View file

@ -1519,7 +1519,7 @@ the WIDTH times as wide as FACE on FRAME. */)
Lisp_Object maximum, Lisp_Object width)
{
struct frame *f;
int size, avgwidth IF_LINT (= 0);
int size, avgwidth;
check_window_system (NULL);
CHECK_STRING (pattern);

View file

@ -9393,7 +9393,7 @@ static char *error_msg;
/* Handle the loss of connection to display DPY. ERROR_MESSAGE is
the text of an error message that lead to the connection loss. */
static void
static _Noreturn void
x_connection_closed (Display *dpy, const char *error_message, bool ioerror)
{
struct x_display_info *dpyinfo = x_display_info_for_display (dpy);
@ -9491,9 +9491,6 @@ For details, see etc/PROBLEMS.\n",
unbind_to (idx, Qnil);
clear_waiting_for_input ();
/* Tell GCC not to suggest attribute 'noreturn' for this function. */
IF_LINT (if (! terminal_list) return; )
/* Here, we absolutely have to use a non-local exit (e.g. signal, throw,
longjmp), because returning from this function would get us back into
Xlib's code which will directly call `exit'. */
@ -9559,7 +9556,7 @@ x_error_quitter (Display *display, XErrorEvent *event)
It kills all frames on the display that we lost touch with.
If that was the only one, it prints an error message and kills Emacs. */
static int
static _Noreturn int
x_io_error_quitter (Display *display)
{
char buf[256];
@ -9567,7 +9564,7 @@ x_io_error_quitter (Display *display)
snprintf (buf, sizeof buf, "Connection lost to X server '%s'",
DisplayString (display));
x_connection_closed (display, buf, true);
return 0;
assume (false);
}
/* Changing the font of the frame. */