mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-13 06:13:02 +00:00
* 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:
@@ -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])
|
||||
|
||||
Reference in New Issue
Block a user