api.header.include: document it, and fix its default value

While defining api.header.include worked as expected, its default
value was incorrectly defined.  As a result, by default, the generated
parsers still duplicated the content of the generated header instead
of including it.

* data/skeletons/yacc.c (api.header.include): Fix its default value.
* tests/output.at: Check it.
* doc/bison.texi (%define Summary): Document api.header.include.
While at it, move the definition of api.namespace at the proper
place.
This commit is contained in:
Akim Demaille
2020-06-09 07:08:11 +02:00
parent ae5edcc23b
commit a53c6026cd
5 changed files with 112 additions and 34 deletions

View File

@@ -30,9 +30,10 @@ m4_define([AT_CHECK_FILES],
[], [$1
])])
# AT_CHECK_OUTPUT(INPUT-FILE, [DIRECTIVES], [FLAGS], EXPECTED-FILES, [STATUS],
# [ADDITIONAL-TESTS], [PRE-TESTS])
# -----------------------------------------------------------------------------
# AT_CHECK_OUTPUT($1 = INPUT-FILE, $2 = [DIRECTIVES], $3 = [FLAGS],
# $4 = EXPECTED-FILES, $5 = [STATUS],
# $6 = [ADDITIONAL-TESTS], $7 = [PRE-TESTS])
# -----------------------------------------------------------------
m4_define([AT_CHECK_OUTPUT],
[AT_SETUP([[Output files: ]$2 $3])[
]$7[
@@ -73,8 +74,19 @@ AT_CHECK_OUTPUT([foo.y], [], [-dv >&-],
[], [],
[AT_CHECK([[case "$PREBISON" in *valgrind*) exit 77;; esac]])])
# Check how api.header.include.
AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.c],
[foo.c foo.h foo.output])
[foo.c foo.h foo.output], [],
[AT_CHECK([grep '#include "foo.h"' foo.c], [0], [ignore])])
AT_CHECK_OUTPUT([foo.y], [], [-dv -y],
[y.output y.tab.c y.tab.h], [],
[AT_CHECK([grep '#include "y.tab.h"' y.tab.c], [1], [ignore])])
AT_CHECK_OUTPUT([foo.y], [%define api.header.include {"./foo.h"}], [-dv -y],
[y.output y.tab.c y.tab.h], [],
[AT_CHECK([grep '#include "./foo.h"' y.tab.c], [0], [ignore])])
AT_CHECK_OUTPUT([foo.y], [], [-dv -o foo.tab.c],
[foo.output foo.tab.c foo.tab.h])