emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] master d631235: Improve --enable-gcc-warnings for MinGW64


From: Paul Eggert
Subject: [Emacs-diffs] master d631235: Improve --enable-gcc-warnings for MinGW64
Date: Sat, 9 Sep 2017 14:11:56 -0400 (EDT)

branch: master
commit d63123542ffd60dbec0c9038144329b99f0f1d65
Author: Paul Eggert <address@hidden>
Commit: Paul Eggert <address@hidden>

    Improve --enable-gcc-warnings for MinGW64
    
    This partially reverts my 2016-05-30 patch.  Apparently MinGW64
    still requires pacifications that GCC 7.1.1 x86-64 (Fedora 26)
    does not.  Also, pacify tparam.c, which isn’t used on Fedora.
    * lib-src/etags.c (process_file_name, TeX_commands):
    * src/buffer.c (fix_overlays_before):
    * src/data.c (Fmake_variable_buffer_local, cons_to_unsigned)
    (cons_to_signed):
    * src/editfns.c (Ftranslate_region_internal):
    Prefer UNINIT to some stray value, as this simplifies
    code-reading later.
    * src/eval.c (CACHEABLE): New macro.
    (internal_lisp_condition_case): Use it.
    * src/tparam.c (tparam1): Use FALLTHROUGH to pacify GCC.
---
 lib-src/etags.c |  4 ++--
 src/buffer.c    |  2 +-
 src/data.c      |  6 +++---
 src/editfns.c   |  5 +++--
 src/eval.c      | 11 ++++++++++-
 src/tparam.c    |  7 +++++++
 6 files changed, 26 insertions(+), 9 deletions(-)

diff --git a/lib-src/etags.c b/lib-src/etags.c
index 724cce6..38be60e 100644
--- a/lib-src/etags.c
+++ b/lib-src/etags.c
@@ -1528,7 +1528,7 @@ process_file_name (char *file, language *lang)
   fdesc *fdp;
   compressor *compr;
   char *compressed_name, *uncompressed_name;
-  char *ext, *real_name = NULL, *tmp_name;
+  char *ext, *real_name UNINIT, *tmp_name;
   int retval;
 
   canonicalize_filename (file);
@@ -5594,7 +5594,7 @@ TeX_commands (FILE *inf)
   linebuffer *key;
 
   char TEX_esc = '\0';
-  char TEX_opgrp = 0, TEX_clgrp = 0;
+  char TEX_opgrp UNINIT, TEX_clgrp UNINIT;
 
   /* Initialize token table once from environment. */
   if (TEX_toktab == NULL)
diff --git a/src/buffer.c b/src/buffer.c
index 0827e9b..f2689b6 100644
--- a/src/buffer.c
+++ b/src/buffer.c
@@ -3764,7 +3764,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 = prev;
+  ptrdiff_t end UNINIT;
 
   /* After the insertion, the several overlays may be in incorrect
      order.  The possibility is that, in the list `overlays_before',
diff --git a/src/data.c b/src/data.c
index 87010e3..c9818b6 100644
--- a/src/data.c
+++ b/src/data.c
@@ -1823,7 +1823,7 @@ 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;
-  bool forwarded = false;
+  bool forwarded UNINIT;
 
   CHECK_SYMBOL (variable);
   sym = XSYMBOL (variable);
@@ -2607,7 +2607,7 @@ uintmax_t
 cons_to_unsigned (Lisp_Object c, uintmax_t max)
 {
   bool valid = false;
-  uintmax_t val = max;
+  uintmax_t val UNINIT;
   if (INTEGERP (c))
     {
       valid = XINT (c) >= 0;
@@ -2661,7 +2661,7 @@ intmax_t
 cons_to_signed (Lisp_Object c, intmax_t min, intmax_t max)
 {
   bool valid = false;
-  intmax_t val = max;
+  intmax_t val UNINIT;
   if (INTEGERP (c))
     {
       val = XINT (c);
diff --git a/src/editfns.c b/src/editfns.c
index 95f3554..d54c9c1 100644
--- a/src/editfns.c
+++ b/src/editfns.c
@@ -3612,8 +3612,9 @@ It returns the number of characters changed.  */)
   cnt = 0;
   for (; pos < end_pos; )
     {
-      register unsigned char *p = BYTE_POS_ADDR (pos_byte);
-      unsigned char *str = tt, buf[MAX_MULTIBYTE_LENGTH];
+      unsigned char *p = BYTE_POS_ADDR (pos_byte);
+      unsigned char *str UNINIT;
+      unsigned char buf[MAX_MULTIBYTE_LENGTH];
       int len, str_len;
       int oc;
       Lisp_Object val;
diff --git a/src/eval.c b/src/eval.c
index c2cd6c6..a6612b9 100644
--- a/src/eval.c
+++ b/src/eval.c
@@ -30,6 +30,15 @@ along with GNU Emacs.  If not, see 
<http://www.gnu.org/licenses/>.  */
 #include "dispextern.h"
 #include "buffer.h"
 
+/* CACHEABLE is ordinarily nothing, except it is 'volatile' if
+   necessary to cajole GCC into not warning incorrectly that a
+   variable should be volatile.  */
+#if defined GCC_LINT || defined lint
+# define CACHEABLE volatile
+#else
+# define CACHEABLE /* empty */
+#endif
+
 /* Chain of condition and catch handlers currently in effect.  */
 
 /* struct handler *handlerlist; */
@@ -1226,7 +1235,7 @@ internal_lisp_condition_case (Lisp_Object var, 
Lisp_Object bodyform,
                              Lisp_Object handlers)
 {
   struct handler *oldhandlerlist = handlerlist;
-  volatile ptrdiff_t clausenb = 0;
+  ptrdiff_t CACHEABLE clausenb = 0;
 
   CHECK_SYMBOL (var);
 
diff --git a/src/tparam.c b/src/tparam.c
index 7a4adc2..92fa5b1 100644
--- a/src/tparam.c
+++ b/src/tparam.c
@@ -125,6 +125,7 @@ tparam1 (const char *string, char *outstring, int len,
                goto onedigit;
              if (tem < 100)
                goto twodigit;
+             FALLTHROUGH;
            case '3':           /* %3 means output in decimal, 3 digits.  */
              if (tem > 999)
                {
@@ -132,6 +133,7 @@ tparam1 (const char *string, char *outstring, int len,
                  tem %= 1000;
                }
              *op++ = tem / 100 + '0';
+             FALLTHROUGH;
            case '2':           /* %2 means output in decimal, 2 digits.  */
            twodigit:
              tem %= 100;
@@ -140,10 +142,12 @@ tparam1 (const char *string, char *outstring, int len,
              *op++ = tem % 10 + '0';
              argp++;
              break;
+
             case 'p':           /* %pN means use param N for next subst.  */
              tem = fixed_argp[(*p++) - '1'];
              explicit_param_p = true;
              break;
+
            case 'C':
              /* For c-100: print quotient of value by 96, if nonzero,
                 then do like %+.  */
@@ -152,8 +156,10 @@ tparam1 (const char *string, char *outstring, int len,
                  *op++ = tem / 96;
                  tem %= 96;
                }
+             FALLTHROUGH;
            case '+':           /* %+x means add character code of char x.  */
              tem += *p++;
+             FALLTHROUGH;
            case '.':           /* %. means output as character.  */
              if (left)
                {
@@ -173,6 +179,7 @@ tparam1 (const char *string, char *outstring, int len,
                    }
                }
              *op++ = tem ? tem : 0200;
+             FALLTHROUGH;
            case 'f':           /* %f means discard next arg.  */
              argp++;
              break;



reply via email to

[Prev in Thread] Current Thread [Next in Thread]