mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 04:13:03 +00:00
build: fix warnings (shown on IRIX)
Appearing on IRIX with gcc -mabi=n32. Reported by Bruno Haible. https://lists.gnu.org/r/bug-bison/2020-05/msg00039.html * examples/c++/variant-11.yy, examples/c/bistromathic/parse.y: Don't give chars to isdigit, cast them to unsigned char before. * src/complain.c: Use c_isdigit. * src/fixits.c (fixits_run): Avoid casts. * src/lalr.c (goto_print): Use %zu for a size_t.
This commit is contained in:
@@ -139,7 +139,7 @@ namespace yy
|
|||||||
int
|
int
|
||||||
main (int argc, const char *argv[])
|
main (int argc, const char *argv[])
|
||||||
{
|
{
|
||||||
if (2 <= argc && isdigit (*argv[1]))
|
if (2 <= argc && isdigit (static_cast<unsigned char> (*argv[1])))
|
||||||
{
|
{
|
||||||
auto maxl = strtol (argv[1], nullptr, 10);
|
auto maxl = strtol (argv[1], nullptr, 10);
|
||||||
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
max = INT_MIN <= maxl && maxl <= INT_MAX ? int(maxl) : 4;
|
||||||
|
|||||||
@@ -363,7 +363,7 @@ yyreport_syntax_error (const yypcontext_t *ctx)
|
|||||||
}
|
}
|
||||||
// %0e, %1e...: expected token.
|
// %0e, %1e...: expected token.
|
||||||
else if (format[0] == '%'
|
else if (format[0] == '%'
|
||||||
&& isdigit (format[1])
|
&& isdigit ((unsigned char) format[1])
|
||||||
&& format[2] == 'e'
|
&& format[2] == 'e'
|
||||||
&& (format[1] - '0') < argsize)
|
&& (format[1] - '0') < argsize)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "system.h"
|
#include "system.h"
|
||||||
|
|
||||||
#include <argmatch.h>
|
#include <argmatch.h>
|
||||||
#include <ctype.h>
|
#include <c-ctype.h>
|
||||||
#include <progname.h>
|
#include <progname.h>
|
||||||
#include <stdarg.h>
|
#include <stdarg.h>
|
||||||
#include <sys/stat.h>
|
#include <sys/stat.h>
|
||||||
@@ -609,7 +609,7 @@ syntax_error (location loc,
|
|||||||
|
|
||||||
while (*format)
|
while (*format)
|
||||||
if (format[0] == '%'
|
if (format[0] == '%'
|
||||||
&& isdigit (format[1])
|
&& c_isdigit (format[1])
|
||||||
&& format[2] == '$'
|
&& format[2] == '$'
|
||||||
&& format[3] == 's'
|
&& format[3] == 's'
|
||||||
&& (format[1] - '0') < argc)
|
&& (format[1] - '0') < argc)
|
||||||
|
|||||||
@@ -124,10 +124,11 @@ fixits_run (void)
|
|||||||
FILE *out = xfopen (input, "w");
|
FILE *out = xfopen (input, "w");
|
||||||
size_t line = 1;
|
size_t line = 1;
|
||||||
size_t offset = 1;
|
size_t offset = 1;
|
||||||
fixit const *f = NULL;
|
void const *p = NULL;
|
||||||
gl_list_iterator_t iter = gl_list_iterator (fixits);
|
gl_list_iterator_t iter = gl_list_iterator (fixits);
|
||||||
while (gl_list_iterator_next (&iter, (const void**) &f, NULL))
|
while (gl_list_iterator_next (&iter, &p, NULL))
|
||||||
{
|
{
|
||||||
|
fixit const *f = p;
|
||||||
/* Look for the correct line. */
|
/* Look for the correct line. */
|
||||||
while (line < f->location.start.line)
|
while (line < f->location.start.line)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ goto_print (goto_number i, FILE *out)
|
|||||||
const state_number dst = to_state[i];
|
const state_number dst = to_state[i];
|
||||||
symbol_number var = states[dst]->accessing_symbol;
|
symbol_number var = states[dst]->accessing_symbol;
|
||||||
fprintf (out,
|
fprintf (out,
|
||||||
"goto[%ld] = (%d, %s, %d)", i, src, symbols[var]->tag, dst);
|
"goto[%zu] = (%d, %s, %d)", i, src, symbols[var]->tag, dst);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
|
|||||||
Reference in New Issue
Block a user