From: Paul Eggert Date: Sat, 9 Sep 2017 18:10:35 +0000 (-0700) Subject: Improve --enable-gcc-warnings for MinGW64 X-Git-Tag: emacs-26.0.90~214 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=d63123542ffd60dbec0c9038144329b99f0f1d65;p=emacs.git 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. --- diff --git a/lib-src/etags.c b/lib-src/etags.c index 724cce63955..38be60e9cbb 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 0827e9ba445..f2689b61fdb 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 87010e3fb28..c9818b6b20f 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 95f35549e4e..d54c9c1abaf 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 c2cd6c60ea4..a6612b93e25 100644 --- a/src/eval.c +++ b/src/eval.c @@ -30,6 +30,15 @@ along with GNU Emacs. If not, see . */ #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 7a4adc2dc94..92fa5b19df7 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;