bug-bison
[Top][All Lists]
Advanced

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

Re: [GNU Bison 2.4.2] testsuite: Failing tests of bison 2.4.2 on Solari


From: tys lefering
Subject: Re: [GNU Bison 2.4.2] testsuite: Failing tests of bison 2.4.2 on Solaris 8+9 w/Sun Studio 11+12
Date: Sun, 4 Apr 2010 01:26:43 +0200
User-agent: SquirrelMail/1.4.18

On Sat, April 3, 2010 21:25, Joel E. Denny wrote:
> Please let us know if this patch, not yet pushed, works for you.  I've
> included the generated changes, which are important for testing the patch.
> Subject: [PATCH] portability: fix pointer arithmetic to conform to C
> standard.
Now ./configure --enable-gcc-warnings=yes and make maintainer-check
does not have warnings on bison files, only few left on gnulib files.

## ------------- ##
## Test results. ##
## ------------- ##

All 290 tests behaved as expected.

Noticed that first time doing at once 'make maintainer-check' does
not run 'make' first to compile binary, but runs testsuite with failed tests.

For fun tried nasty gcc compiler flags as they are used to compile
gcc-4.5.0 development version itself, applied to Bison source:

gcc -std=gnu99  -I. -I../lib  -I../lib  -Wall -Wextra -Wno-sign-compare
-Wcast-align -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings
-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wshadow
-Wstrict-prototypes -g -fkeep-inline-functions -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Wold-style-definition  -fno-common  -g -O2 -MT
complain.o -MD -MP -MF .deps/complain.Tpo -c -o complain.o complain.c
complain.c: In function 'error_message':
complain.c:70:3: warning: function might be possible candidate for
'gnu_printf' format attribute

gcc -std=gnu99  -I. -I../lib  -I../lib  -Wall -Wextra -Wno-sign-compare
-Wcast-align -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings
-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wshadow
-Wstrict-prototypes -g -fkeep-inline-functions -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Wold-style-definition  -fno-common  -g -O2 -MT
print-xml.o -MD -MP -MF .deps/print-xml.Tpo -c -o print-xml.o print-xml.c
print-xml.c: In function 'xml_printf':
print-xml.c:453:3: warning: function might be possible candidate for
'gnu_printf' format attribute

gcc -std=gnu99  -I. -I../lib  -I../lib  -Wall -Wextra -Wno-sign-compare
-Wcast-align -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings
-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wshadow
-Wstrict-prototypes -g -fkeep-inline-functions -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Wold-style-definition  -fno-common  -g -O2 -MT
scan-code-c.o -MD -MP -MF .deps/scan-code-c.Tpo -c -o scan-code-c.o
scan-code-c.c
In file included from scan-code-c.c:3:0:
scan-code.l: In function 'parse_ref':
scan-code.l:525:7: warning: ISO C forbids braced-groups within expressions
scan-code.l:525:41: warning: ISO C forbids braced-groups within expressions

gcc -std=gnu99  -I. -I../lib  -I../lib  -Wall -Wextra -Wno-sign-compare
-Wcast-align -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings
-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wshadow
-Wstrict-prototypes -g -fkeep-inline-functions -W -Wall -Wwrite-strings
-Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Wold-style-definition  -fno-common  -g -O2 -MT
scan-skel-c.o -MD -MP -MF .deps/scan-skel-c.Tpo -c -o scan-skel-c.o
scan-skel-c.c
In file included from scan-skel-c.c:3:0:
scan-skel.l: In function 'at_directive_perform':
scan-skel.l:196:26: warning: assignment left-hand side might be a
candidate for a format attribute
scan-skel.l:197:26: warning: assignment left-hand side might be a
candidate for a format attribute
scan-skel.l:198:26: warning: assignment left-hand side might be a
candidate for a format attribute
scan-skel.l:237:26: warning: assignment left-hand side might be a
candidate for a format attribute
scan-skel.l:238:26: warning: assignment left-hand side might be a
candidate for a format attribute
scan-skel.l:239:26: warning: assignment left-hand side might be a
candidate for a format attribute

adding gcc option -Wc++-compat issues many warnings about things not
compatible with c++ like:

gcc -std=gnu99  -I. -I../lib  -I../lib  -Wall -Wextra -Wno-sign-compare
-Wcast-align -Wcast-qual -Wformat -Wpointer-arith -Wwrite-strings
-Wbad-function-cast -Wmissing-declarations -Wmissing-prototypes -Wshadow
-Wstrict-prototypes -Wc++-compat -g -fkeep-inline-functions -W -Wall
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Wold-style-definition  -fno-common  -g -O2 -MT
AnnotationList.o -MD -MP -MF .deps/AnnotationList.Tpo -c -o
AnnotationList.o AnnotationList.c
In file included from symtab.h:31:0,
                 from gram.h:106,
                 from InadequacyList.h:24,
                 from AnnotationList.h:25,
                 from AnnotationList.c:23:
scan-code.h:51:12: warning: using 'location' as both field and typedef
name is invalid in C++
scan-code.h:70:14: warning: using 'named_ref' as both field and typedef
name is invalid in C++
In file included from gram.h:106:0,
                 from InadequacyList.h:24,
                 from AnnotationList.h:25,
                 from AnnotationList.c:23:
symtab.h:66:3: warning: C++ lookup of 'location' would return a field, not
a type
symtab.h:83:3: warning: C++ lookup of 'location' would return a field, not
a type

etc. ... and:

symtab.h:92:16: warning: identifier 'class' conflicts with C++ keyword
LR0.c:309:19: warning: identifier 'this' conflicts with C++ keyword
reader.c:239:12: warning: identifier 'class' conflicts with C++ keyword
symtab.c:88:8: warning: identifier 'class' conflicts with C++ keyword

for these tests added in configure.ac the next line with gcc-4.5.0
compilation flags:
WARN_CFLAGS="$WARN_CFLAGS -g -fkeep-inline-functions -W -Wall
-Wwrite-strings -Wcast-qual -Wstrict-prototypes -Wmissing-prototypes
-Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros
-Wno-overlength-strings -Wold-style-definition  -fno-common"

Thanks for these patches and now bison compiles even better then before.

--

Also came across postgresql bison yacc parser with this comment:

/* Location tracking support --- simpler than bison's default */
#define YYLLOC_DEFAULT(Current, Rhs, N) \
        do { \
                if (N) \
                        (Current) = (Rhs)[1]; \
                else \
                        (Current) = (Rhs)[0]; \
        } while (0)

And a way to wrap bison yacc malloc/free to own routines which is
not in the bison manual, supposed unsupported (?) but it works.

/*
 * Bison doesn't allocate anything that needs to live across parser calls,
 * so we can easily have it use palloc instead of malloc.  This prevents
 * memory leaks if we error out during parsing.  Note this only works with
 * bison >= 2.0.  However, in bison 1.875 the default is to use alloca()
 * if possible, so there's not really much problem anyhow, at least if
 * you're building with gcc.
 */
#define YYMALLOC palloc
#define YYFREE   pfree

flex has a easy way for wrapping calls to own malloc/free/realloc using
%option noyyalloc, noyyrealloc and noyyfree and adding own routines for
yyalloc(), yyrealloc(), yyfree(). the same is not possible with bison.

http://flex.sourceforge.net/manual/Overriding-The-Default-Memory-Management.html

Thanks,
Tys Lefering.






reply via email to

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