* tests/regression.at (AT_TEST_CPP_GUARD_H): New.

Check that `9foo.y' produces correct cpp guards.
* src/files.c (compute_header_macro): Prepend `BISON_' to CPP
guards.
Reported by Wwp.
This commit is contained in:
Akim Demaille
2001-11-01 18:29:36 +00:00
parent 705131d1de
commit 1d708336d4
17 changed files with 141 additions and 112 deletions

View File

@@ -148,23 +148,34 @@ AT_CHECK([bison input.y], [1], [],
AT_CLEANUP
## --------------------- ##
## Invalid CPP headers. ##
## --------------------- ##
AT_SETUP([Invalid CPP headers])
# AT_TEST_CPP_GUARD_H([INPUT-FILE-BASE)
# -------------------------------------
m4_define([AT_TEST_CPP_GUARD_H],
[AT_SETUP([Invalid CPP guards: $1])
mkdir input
# possibly create and nuke inner directories.
m4_bmatch([$1], [[/]],
[dirname=`AS_DIRNAME([$1])`
AS_MKDIR_P([$dirname])
AT_CLEANUP_FILES([$dirname])])
AT_DATA([input/input.y],
AT_DATA([$1.y],
[%%
dummy:
])
AT_CHECK([bison --defines input/input.y])
AT_CHECK([bison --defines=$1.h $1.y])
AT_CHECK([sed 1q input/input.tab.h], 0,
[[#ifndef INPUT_INPUT_TAB_H
]])
# CPP should be happy with it.
AT_CHECK([$CC -E $1.h], 0, [ignore])
AT_CLEANUP(input)
AT_CLEANUP($1.y)
])
AT_TEST_CPP_GUARD_H([input/input])
AT_TEST_CPP_GUARD_H([9foo])