From: Paul Eggert Date: Sat, 25 Apr 2015 05:37:11 +0000 (-0700) Subject: Port --enable-gcc-warnings to GCC 5.1 x86-64 X-Git-Tag: emacs-25.0.90~2307 X-Git-Url: https://code.delx.au/gnu-emacs/commitdiff_plain/52ba851db188de47b303120df00c77e3aad7e542 Port --enable-gcc-warnings to GCC 5.1 x86-64 * lib-src/ebrowse.c (dump_sym): * lib-src/hexl.c (main): * src/ccl.c (ccl_driver): * src/character.c (string_escape_byte8): * src/dbusbind.c (xd_retrieve_arg, xd_add_watch): * src/gnutls.c (Fgnutls_boot): * src/gtkutil.c (xg_check_special_colors): * src/image.c (x_build_heuristic_mask): * src/print.c (safe_debug_print, print_object): * src/term.c (produce_glyphless_glyph): * src/xdisp.c (get_next_display_element) (produce_glyphless_glyph): * src/xterm.c (x_draw_glyphless_glyph_string_foreground): Don't use a signed format to print an unsigned integer, or vice versa. GCC 5.1's new -Wformat-signedness option warns about this. * src/image.c (png_load_body, jpeg_load_body): Silence a bogus setjump diagnostic from GCC 5.1 (GCC bug 54561). --- diff --git a/lib-src/ebrowse.c b/lib-src/ebrowse.c index d16c9ae54a..5c1e9d99bb 100644 --- a/lib-src/ebrowse.c +++ b/lib-src/ebrowse.c @@ -1241,7 +1241,7 @@ dump_sym (FILE *fp, struct sym *root) putstr (NULL, fp); /* Print flags. */ - fprintf (fp, "%u", root->flags); + fprintf (fp, "%d", root->flags); putstr (root->filename, fp); putstr (root->regexp, fp); fprintf (fp, "%u", (unsigned) root->pos); diff --git a/lib-src/hexl.c b/lib-src/hexl.c index 490f72731b..ac493c2740 100644 --- a/lib-src/hexl.c +++ b/lib-src/hexl.c @@ -216,7 +216,7 @@ main (int argc, char **argv) else { if (!i) - printf ("%08lx: ", address); + printf ("%08lx: ", address + 0ul); if (iso_flag) string[i+1] = @@ -224,7 +224,7 @@ main (int argc, char **argv) else string[i+1] = (c < 0x20 || c >= 0x7F) ? '.' : c; - printf ("%02x", c); + printf ("%02x", c + 0u); } if ((i&group_by) == group_by) diff --git a/src/ccl.c b/src/ccl.c index 053544c827..88307a30aa 100644 --- a/src/ccl.c +++ b/src/ccl.c @@ -1713,7 +1713,7 @@ ccl_driver (struct ccl_program *ccl, int *source, int *destination, int src_size case CCL_STAT_INVALID_CMD: msglen = sprintf (msg, "\nCCL: Invalid command %x (ccl_code = %x) at %d.", - code & 0x1F, code, this_ic); + code & 0x1Fu, code + 0u, this_ic); #ifdef CCL_DEBUG { int i = ccl_backtrace_idx - 1; diff --git a/src/character.c b/src/character.c index c143c0f0e3..f51d97125e 100644 --- a/src/character.c +++ b/src/character.c @@ -841,7 +841,7 @@ string_escape_byte8 (Lisp_Object string) { c = STRING_CHAR_ADVANCE (src); c = CHAR_TO_BYTE8 (c); - dst += sprintf ((char *) dst, "\\%03o", c); + dst += sprintf ((char *) dst, "\\%03o", c + 0u); } else while (len--) *dst++ = *src++; @@ -851,7 +851,7 @@ string_escape_byte8 (Lisp_Object string) { c = *src++; if (c >= 0x80) - dst += sprintf ((char *) dst, "\\%03o", c); + dst += sprintf ((char *) dst, "\\%03o", c + 0u); else *dst++ = c; } diff --git a/src/dbusbind.c b/src/dbusbind.c index 54e92cce16..fa26f9e416 100644 --- a/src/dbusbind.c +++ b/src/dbusbind.c @@ -874,7 +874,7 @@ xd_retrieve_arg (int dtype, DBusMessageIter *iter) uprintmax_t pval; dbus_message_iter_get_basic (iter, &val); pval = val; - XD_DEBUG_MESSAGE ("%c %"pMd, dtype, pval); + XD_DEBUG_MESSAGE ("%c %"pMu, dtype, pval); return make_fixnum_or_float (val); } @@ -990,7 +990,7 @@ xd_add_watch (DBusWatch *watch, void *data) unsigned int flags = dbus_watch_get_flags (watch); int fd = xd_find_watch_fd (watch); - XD_DEBUG_MESSAGE ("fd %d, write %d, enabled %d", + XD_DEBUG_MESSAGE ("fd %d, write %u, enabled %u", fd, flags & DBUS_WATCH_WRITABLE, dbus_watch_get_enabled (watch)); diff --git a/src/gnutls.c b/src/gnutls.c index ddd36a91e9..9b8ae2bd1a 100644 --- a/src/gnutls.c +++ b/src/gnutls.c @@ -1512,7 +1512,7 @@ one trustfile (usually a CA bundle). */) || !NILP (Fmember (QCgnutls_bootprop_trustfiles, verify_error))) { emacs_gnutls_deinit (proc); - error ("Certificate validation failed %s, verification code %d", + error ("Certificate validation failed %s, verification code %u", c_hostname, peer_verification); } else diff --git a/src/gtkutil.c b/src/gtkutil.c index 41cc7a7466..b51d3388ac 100644 --- a/src/gtkutil.c +++ b/src/gtkutil.c @@ -579,9 +579,9 @@ xg_check_special_colors (struct frame *f, gtk_style_context_get_background_color (gsty, state, &col); sprintf (buf, "rgb:%04x/%04x/%04x", - (int)(col.red * 65535), - (int)(col.green * 65535), - (int)(col.blue * 65535)); + (unsigned) (col.red * 65535), + (unsigned) (col.green * 65535), + (unsigned) (col.blue * 65535)); success_p = (XParseColor (FRAME_X_DISPLAY (f), FRAME_X_COLORMAP (f), buf, color) != 0); diff --git a/src/image.c b/src/image.c index df299bbd16..5e4843834c 100644 --- a/src/image.c +++ b/src/image.c @@ -4964,7 +4964,8 @@ x_build_heuristic_mask (struct frame *f, struct image *img, Lisp_Object how) if (i == 3 && NILP (how)) { char color_name[30]; - sprintf (color_name, "#%04x%04x%04x", rgb[0], rgb[1], rgb[2]); + sprintf (color_name, "#%04x%04x%04x", + rgb[0] + 0u, rgb[1] + 0u, rgb[2] + 0u); bg = ( #ifdef HAVE_NTGUI 0x00ffffff & /* Filter out palette info. */ @@ -5729,6 +5730,7 @@ 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)) { @@ -5825,6 +5827,7 @@ png_load_body (struct frame *f, struct image *img, struct png_load_context *c) /* 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)) @@ -6467,6 +6470,7 @@ 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)) { @@ -6528,6 +6532,9 @@ 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); diff --git a/src/print.c b/src/print.c index bff5932c1d..206466ce68 100644 --- a/src/print.c +++ b/src/print.c @@ -794,9 +794,12 @@ safe_debug_print (Lisp_Object arg) if (valid > 0) debug_print (arg); else - fprintf (stderr, "#<%s_LISP_OBJECT 0x%08"pI"x>\r\n", - !valid ? "INVALID" : "SOME", - XLI (arg)); + { + EMACS_UINT n = XLI (arg); + fprintf (stderr, "#<%s_LISP_OBJECT 0x%08"pI"x>\r\n", + !valid ? "INVALID" : "SOME", + n); + } } @@ -1422,7 +1425,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) print single-byte non-ASCII string chars using octal escapes. */ char outbuf[5]; - int len = sprintf (outbuf, "\\%03o", c); + int len = sprintf (outbuf, "\\%03o", c + 0u); strout (outbuf, len, len, printcharfun); need_nonhex = false; } @@ -1431,7 +1434,7 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) { /* When requested, print multibyte chars using hex escapes. */ char outbuf[sizeof "\\x" + INT_STRLEN_BOUND (c)]; - int len = sprintf (outbuf, "\\x%04x", c); + int len = sprintf (outbuf, "\\x%04x", c + 0u); strout (outbuf, len, len, printcharfun); need_nonhex = true; } @@ -2094,11 +2097,11 @@ print_object (Lisp_Object obj, Lisp_Object printcharfun, bool escapeflag) Probably should just emacs_abort (). */ print_c_string ("#"), diff --git a/src/term.c b/src/term.c index 15d33b4e3e..d2a9c3d1f3 100644 --- a/src/term.c +++ b/src/term.c @@ -1862,9 +1862,11 @@ produce_glyphless_glyph (struct it *it, Lisp_Object acronym) else { eassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); - len = (it->c < 0x10000 ? sprintf (buf, "\\u%04X", it->c) - : it->c <= MAX_UNICODE_CHAR ? sprintf (buf, "\\U%06X", it->c) - : sprintf (buf, "\\x%06X", it->c)); + len = sprintf (buf, + (it->c < 0x10000 ? "\\u%04X" + : it->c <= MAX_UNICODE_CHAR ? "\\U%06X" + : "\\x%06X"), + it->c + 0u); } str = buf; } diff --git a/src/xdisp.c b/src/xdisp.c index 6ca190636e..5a27adc2b1 100644 --- a/src/xdisp.c +++ b/src/xdisp.c @@ -6971,7 +6971,7 @@ get_next_display_element (struct it *it) if (CHAR_BYTE8_P (c)) /* Display \200 instead of \17777600. */ c = CHAR_TO_BYTE8 (c); - len = sprintf (str, "%03o", c); + len = sprintf (str, "%03o", c + 0u); XSETINT (it->ctl_chars[0], escape_glyph); for (i = 0; i < len; i++) @@ -26233,7 +26233,7 @@ produce_glyphless_glyph (struct it *it, bool for_no_font, Lisp_Object acronym) else { eassert (it->glyphless_method == GLYPHLESS_DISPLAY_HEX_CODE); - sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c); + sprintf (buf, "%0*X", it->c < 0x10000 ? 4 : 6, it->c + 0u); str = buf; } for (len = 0; str[len] && ASCII_CHAR_P (str[len]) && len < 6; len++) diff --git a/src/xterm.c b/src/xterm.c index 48b250b81a..d9032fa5a1 100644 --- a/src/xterm.c +++ b/src/xterm.c @@ -1285,7 +1285,7 @@ x_draw_glyphless_glyph_string_foreground (struct glyph_string *s) { sprintf (buf, "%0*X", glyph->u.glyphless.ch < 0x10000 ? 4 : 6, - glyph->u.glyphless.ch); + glyph->u.glyphless.ch + 0u); str = buf; }