Commit 52ba851d authored by Paul Eggert's avatar Paul Eggert

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).
parent 59338869
......@@ -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);
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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));
......
......@@ -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
......
......@@ -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);
......
......@@ -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);
......
......@@ -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 ("#<EMACS BUG: INVALID DATATYPE ", printcharfun);
if (MISCP (obj))
len = sprintf (buf, "(MISC 0x%04x)", (int) XMISCTYPE (obj));
len = sprintf (buf, "(MISC 0x%04x)", (unsigned) XMISCTYPE (obj));
else if (VECTORLIKEP (obj))
len = sprintf (buf, "(PVEC 0x%08"pD"x)", ASIZE (obj));
len = sprintf (buf, "(PVEC 0x%08zx)", (size_t) ASIZE (obj));
else
len = sprintf (buf, "(0x%02x)", (int) XTYPE (obj));
len = sprintf (buf, "(0x%02x)", (unsigned) XTYPE (obj));
strout (buf, len, len, printcharfun);
print_c_string ((" Save your buffers immediately"
" and please report this bug>"),
......
......@@ -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;
}
......
......@@ -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++)
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment