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.
This commit is contained in:
Paul Eggert 2017-09-09 11:10:35 -07:00
parent 715f0835b5
commit d63123542f
6 changed files with 26 additions and 9 deletions

View file

@ -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)

View file

@ -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',

View file

@ -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);

View file

@ -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;

View file

@ -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);

View file

@ -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;