]> code.delx.au - gnu-emacs/commitdiff
Port --enable-gcc-warnings to GCC 5.1 x86-64
authorPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Apr 2015 05:37:11 +0000 (22:37 -0700)
committerPaul Eggert <eggert@cs.ucla.edu>
Sat, 25 Apr 2015 05:41:56 +0000 (22:41 -0700)
* 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).

12 files changed:
lib-src/ebrowse.c
lib-src/hexl.c
src/ccl.c
src/character.c
src/dbusbind.c
src/gnutls.c
src/gtkutil.c
src/image.c
src/print.c
src/term.c
src/xdisp.c
src/xterm.c

index d16c9ae54af12f44cd994df05e3ae81ddc6491ea..5c1e9d99bb850e2a50cc21e70d266a62d69d6e25 100644 (file)
@@ -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);
index 490f72731b4277fce153859a5668d667e86c369f..ac493c2740cd0eedd47e1ab42755408a25ec8b7b 100644 (file)
@@ -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)
index 053544c8274789d5768454a1ee8074ce2d3d139b..88307a30aa697f953585ffe56f57a9d46d2cd7d4 100644 (file)
--- 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;
index c143c0f0e3efcd5f21adfa2b55fa16d11d03c0d9..f51d97125e08cd4634625c27ba4411c4c7d95b85 100644 (file)
@@ -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;
       }
index 54e92cce16e7486017bc2c0a5859897e399f6241..fa26f9e41680c5059c25fa4569de79584be7beb3 100644 (file)
@@ -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));
 
index ddd36a91e9f61b30965b1311b6a0901f6e6cf521..9b8ae2bd1a875a64953c2bc53d3ef0d94ccdeca0 100644 (file)
@@ -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
index 41cc7a746643c2332974c740fd81c145ddfeebdc..b51d3388aca2b3eb3f077611e39f2529e1d757b9 100644 (file)
@@ -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);
index df299bbd1646c4dd665f276122624432b7fb27d9..5e4843834c198b037a9877d595db501f433d6587 100644 (file)
@@ -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);
index bff5932c1d1c3fac54265784a0b4cd6c22be7771..206466ce68f0db4cd5c93a34d01d78f58cc00237 100644 (file)
@@ -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);
+    }
 }
 
 \f
@@ -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>"),
index 15d33b4e3ee48986c664902ba06f35102024af0c..d2a9c3d1f300c11dfe2bbf1c6889a6354e4d277e 100644 (file)
@@ -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;
     }
index 6ca190636ecb4dd397f791c6c20191a0c2d910d6..5a27adc2b18494421fc529b369029d7fb9522e08 100644 (file)
@@ -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++)
index 48b250b81a3ced7302a7b25faa18dcc5dbd77df2..d9032fa5a1438c11f138c8eb80ba64691cbe1d93 100644 (file)
@@ -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;
        }