From bc96b757ca129aa63e41aa6e5dcfbbbad3916e01 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Fri, 4 Oct 2019 06:49:40 +0200 Subject: [PATCH] yacc.c: fix warnings about undefined macros For instance with GCC 4.9 and --enable-gcc-warnings: 25. input.at:1201: testing Torturing the Scanner ... ../../tests/input.at:1344: $CC $CFLAGS $CPPFLAGS -c -o input.o input.c stderr: input.c:239:18: error: "__STDC_VERSION__" is not defined [-Werror=undef] # elif 199901 <= __STDC_VERSION__ ^ input.c:256:18: error: "__STDC_VERSION__" is not defined [-Werror=undef] # elif 199901 <= __STDC_VERSION__ ^ * data/skeletons/yacc.c: Check that __STDC_VERSION__ is defined before using it. --- data/skeletons/yacc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/data/skeletons/yacc.c b/data/skeletons/yacc.c index ce9e2865..f3ef63fe 100644 --- a/data/skeletons/yacc.c +++ b/data/skeletons/yacc.c @@ -419,7 +419,7 @@ typedef short yytype_int16; # elif defined ptrdiff_t && defined PTRDIFF_MAX # define YYPTRDIFF_T ptrdiff_t # define YYPTRDIFF_MAXIMUM PTRDIFF_MAX -# elif 199901 <= __STDC_VERSION__ +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYPTRDIFF_T ptrdiff_t # include /* INFRINGES ON USER NAME SPACE */ @@ -436,7 +436,7 @@ typedef short yytype_int16; # define YYSIZE_T __SIZE_TYPE__ # elif defined size_t # define YYSIZE_T size_t -# elif 199901 <= __STDC_VERSION__ +# elif defined __STDC_VERSION__ && 199901 <= __STDC_VERSION__ # include /* INFRINGES ON USER NAME SPACE */ # define YYSIZE_T size_t # else