Commit Graph

11 Commits

Author SHA1 Message Date
Akim Demaille
d7e8aaa271 package: bump copyrights to 2021
Run 'make update-copyright'.
2021-01-16 16:11:17 +01:00
Akim Demaille
52ce2a008b build: check -Wmissing-prototypes
pstate_clear is lacking a prototype.
Reported by Ryan
https://lists.gnu.org/r/bug-bison/2020-05/msg00101.html

Besides, none of the C examples were compiled with the warning flags.

* configure.ac (warn_c): Add -Wmissing-prototypes.
* data/skeletons/yacc.c (pstate_clear): Make it static.
* examples/local.mk (TEST_CFLAGS): New.
* examples/c/bistromathic/local.mk, examples/c/calc/local.mk,
* examples/c/lexcalc/local.mk, examples/c/mfcalc/local.mk,
* examples/c/pushcalc/local.mk, examples/c/reccalc/local.mk,
* examples/c/rpcalc/local.mk:
Use it.

GCC's warn_unused_result is not silenced by a cast to void, so we have
to "use" scanf's result.
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=25509
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=66425

Flex generated code produces too many warnings, including things such
as, with ICC:

    examples/c/lexcalc/scan.c(1088): error #1682: implicit conversion
              of a 64-bit integral type to a smaller integral type (potential portability problem)
    2259                YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
    2260                ^
    2261
    2262

I am tired of trying to fix Flex's output.  The project does not seem
maintained.  We ought to avoid it.  So, for the time being, don't try
to enable warnings with Flex.

* examples/c/bistromathic/parse.y, examples/c/reccalc/scan.l: Fix
warnings.
* doc/bison.texi: Discard scanf's return value to defeat
-Werror=unused-result.
2020-06-01 08:29:53 +02:00
Akim Demaille
392f3caef6 examples: beware of the portability of flex --header-file
The option --header was introduced in version 2.5.6.
The option --header-file was introduced in version 2.6.4.
Reported by Bruno Haible.
https://lists.gnu.org/r/bug-bison/2020-05/msg00013.html

So use --header, and do bother with versions that don't support it.

* m4/flex.m4: Check whether flex supports --header.
* configure.ac (FLEX_WORKS, FLEX_CXX_WORKS): Set to false if it doesn't.
* * examples/c/reccalc/local.mk, examples/c/reccalc/Makefile:
Use --header rather than --header-file.
2020-05-03 10:32:32 +02:00
Akim Demaille
8036635251 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-05 10:26:35 +01:00
Akim Demaille
719395c9cd examples: fix missing dependencies
Reported by Thomas Petazzoni.
https://lists.gnu.org/archive/html/bug-bison/2019-08/msg00000.html

* examples/c/reccalc/local.mk: Complete dependencies, including for
earlier versions of Automake (for sake of our CI, on top of Ubuntu
Xenial/Bionic, which feature only Automake 1.15).
(%D%/scan.c %D%/scan.h): Upgrade to the full version provided in
Automake's documentation.
2019-10-24 18:01:53 +02:00
Akim Demaille
21aa4b2713 style: comment changes
* examples/c/lexcalc/local.mk, examples/c/reccalc/local.mk:
Here.
2019-06-27 07:57:21 +02:00
Akim Demaille
1934304acf examples: don't run those that require f?lex when it's not available
Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00026.html

* configure.ac (FLEX_WORKS): New.
* examples/c/lexcalc/local.mk, examples/c/reccalc/local.mk: Use it.
2019-05-19 18:41:59 +02:00
Akim Demaille
3f25104caf build: do not use $< in plain rules
It works only in implicit rules (or with GNU Make, but not with
Solaris Make).

Reported by Bruno Haible.
http://lists.gnu.org/archive/html/bug-bison/2019-05/msg00009.html
Diagnosed thanks to Kiyoshi Kanazawa.

* examples/c/reccalc/local.mk, examples/d/local.mk,
* examples/java/local.mk: Don't use $< in non implicit rules.
2019-05-13 22:16:23 +02:00
Akim Demaille
02a1600994 package: add missing CLEANFILES
* examples: here.
2019-04-28 11:39:10 +02:00
Akim Demaille
0cc04eaa2a package: don't ship the sources generated from the parser
Because some of our examples use

    %C%_reccalc_SOURCES = %D%/parse.y

Automake ships parse.y and parse.c, and possibly parse.h when it
"understands" that there is one.  This is not what we want: ship only
parser.y.  Yet we still want to use Automake to compile the sources
from parser.y.  The easiest seems to use

    nodist_%C%_reccalc_SOURCES = %D%/parse.y

together with

    dist_reccalc_DATA = %D%/parse.y %D%/scan.l %D%/Makefile %D%/README.md

which guarantees that parse.y is indeed shipped.

* examples/c/calc/local.mk, examples/c/lexcalc/local.mk,
* examples/c/reccalc/local.mk: Always use nodist_*SOURCES for parsers,
let the dist_*_DATA rules do their job.
2019-04-28 11:39:10 +02:00
Akim Demaille
6289d673a0 examples: add an example with a reentrant parser in Flex+Bison
Suggested by Eric S. Raymond.
https://lists.gnu.org/archive/html/bison-patches/2019-02/msg00066.html

* examples/c/reentrant-calc/Makefile, examples/c/reentrant-calc/README.md,
* examples/c/reentrant-calc/parse.y, examples/c/reentrant-calc/scan.l
* examples/c/reentrant-calc/lexcalc.test,
* examples/c/reentrant-calc/local.mk:
New.
2019-02-17 11:31:51 +01:00