mirror of
https://git.savannah.gnu.org/git/bison.git
synced 2026-03-09 12:23:04 +00:00
tests: generalize the compilation macros.
* tests/local.at (AT_COMPILE, AT_COMPILE_CXX): If OUTPUT ends with ".o", then append the "natural" extension for the input file (.c or .cc). If there is no source, pass -c. * tests/headers.at, tests/input.at, tests/regression.at: Adjust.
This commit is contained in:
@@ -111,8 +111,8 @@ main (void)
|
|||||||
|
|
||||||
# Link and execute, just to make sure everything is fine (and in
|
# Link and execute, just to make sure everything is fine (and in
|
||||||
# particular, that MY_LLOC is indeed defined somewhere).
|
# particular, that MY_LLOC is indeed defined somewhere).
|
||||||
AT_COMPILE([caller.o], [-c caller.c])
|
AT_COMPILE([caller.o])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
AT_COMPILE([caller], [caller.o input.o])
|
AT_COMPILE([caller], [caller.o input.o])
|
||||||
AT_PARSER_CHECK([./caller])
|
AT_PARSER_CHECK([./caller])
|
||||||
|
|
||||||
|
|||||||
@@ -533,8 +533,8 @@ main (void)
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-d -v -o input.c input.y])
|
AT_BISON_CHECK([-d -v -o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
AT_COMPILE([main.o], [-c main.c])
|
AT_COMPILE([main.o])
|
||||||
AT_COMPILE([input], [input.o main.o])
|
AT_COMPILE([input], [input.o main.o])
|
||||||
AT_PARSER_CHECK([./input], 0,
|
AT_PARSER_CHECK([./input], 0,
|
||||||
[[[@<:@],
|
[[[@<:@],
|
||||||
@@ -654,7 +654,7 @@ input.y:18.8-16: warning: POSIX Yacc forbids dashes in symbol names: with-dash
|
|||||||
AT_BISON_CHECK([-o input.c input.y])
|
AT_BISON_CHECK([-o input.c input.y])
|
||||||
|
|
||||||
# Make sure we don't export silly token identifiers with periods or dashes.
|
# Make sure we don't export silly token identifiers with periods or dashes.
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
|
|
||||||
|
|
||||||
# Periods are genuine letters, they can start identifiers.
|
# Periods are genuine letters, they can start identifiers.
|
||||||
|
|||||||
@@ -537,21 +537,37 @@ m4_define([AT_QUELL_VALGRIND],
|
|||||||
|
|
||||||
# AT_COMPILE(OUTPUT, [SOURCES = OUTPUT.c])
|
# AT_COMPILE(OUTPUT, [SOURCES = OUTPUT.c])
|
||||||
# ----------------------------------------
|
# ----------------------------------------
|
||||||
# Compile SOURCES into OUTPUT. If OUTPUT does not contain '.',
|
# Compile SOURCES into OUTPUT.
|
||||||
# assume that we are linking too; this is a hack.
|
#
|
||||||
|
# If OUTPUT does not contain '.', assume that we are linking too,
|
||||||
|
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
|
||||||
|
# with trailing .o removed, and ".c" appended.
|
||||||
m4_define([AT_COMPILE],
|
m4_define([AT_COMPILE],
|
||||||
[AT_CHECK([$CC $CFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.c])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
|
[AT_CHECK(m4_join([ ],
|
||||||
|
[$CC $CFLAGS $CPPFLAGS],
|
||||||
|
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
|
||||||
|
[-o $1],
|
||||||
|
[m4_default([$2], [m4_bpatsubst([$1], [\.o$]).c])],
|
||||||
|
[m4_bmatch([$1], [[.]], [], [$LIBS])]),
|
||||||
0, [ignore], [ignore])])
|
0, [ignore], [ignore])])
|
||||||
|
|
||||||
# AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc])
|
# AT_COMPILE_CXX(OUTPUT, [SOURCES = OUTPUT.cc])
|
||||||
# --------------------------------------------
|
# ---------------------------------------------
|
||||||
# Compile SOURCES into OUTPUT. If OUTPUT does not contain '.',
|
# Compile SOURCES into OUTPUT. If the C++ compiler does not work,
|
||||||
# assume that we are linking too; this is a hack.
|
# ignore the test.
|
||||||
# If the C++ compiler does not work, ignore the test.
|
#
|
||||||
|
# If OUTPUT does not contain '.', assume that we are linking too,
|
||||||
|
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
|
||||||
|
# with trailing .o removed, and ".cc" appended.
|
||||||
m4_define([AT_COMPILE_CXX],
|
m4_define([AT_COMPILE_CXX],
|
||||||
[AT_KEYWORDS(c++)
|
[AT_KEYWORDS(c++)
|
||||||
AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore)
|
AT_CHECK([$BISON_CXX_WORKS], 0, ignore, ignore)
|
||||||
AT_CHECK([$CXX $CXXFLAGS $CPPFLAGS m4_bmatch([$1], [[.]], [], [$LDFLAGS ])-o $1 m4_default([$2], [$1.cc])[]m4_bmatch([$1], [[.]], [], [ $LIBS])],
|
AT_CHECK(m4_join([ ],
|
||||||
|
[$CXX $CXXFLAGS $CPPFLAGS],
|
||||||
|
[m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
|
||||||
|
[-o $1],
|
||||||
|
[m4_default([$2], [m4_bpatsubst([$1], [\.o$]).cc])],
|
||||||
|
[m4_bmatch([$1], [[.]], [], [$LIBS])]),
|
||||||
0, [ignore], [ignore])])
|
0, [ignore], [ignore])])
|
||||||
|
|
||||||
# AT_JAVA_COMPILE(SOURCES)
|
# AT_JAVA_COMPILE(SOURCES)
|
||||||
@@ -566,6 +582,11 @@ AT_CHECK([[$SHELL ../../../javacomp.sh ]$1],
|
|||||||
|
|
||||||
# AT_LANG_COMPILE(OUTPUT, [SOURCES = OUTPUT.c]
|
# AT_LANG_COMPILE(OUTPUT, [SOURCES = OUTPUT.c]
|
||||||
# --------------------------------------------
|
# --------------------------------------------
|
||||||
|
# Compile SOURCES into OUTPUT. Skip if compiler does not work.
|
||||||
|
#
|
||||||
|
# If OUTPUT does not contain '.', assume that we are linking too,
|
||||||
|
# otherwise pass "-c"; this is a hack. The default SOURCES is OUTPUT
|
||||||
|
# with trailing .o removed, and ".c"/".cc" appended.
|
||||||
m4_define([AT_LANG_COMPILE],
|
m4_define([AT_LANG_COMPILE],
|
||||||
[m4_case(AT_LANG,
|
[m4_case(AT_LANG,
|
||||||
[c], [AT_COMPILE([$1], [$2])],
|
[c], [AT_COMPILE([$1], [$2])],
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ program: 'x';
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y])
|
AT_BISON_CHECK([-o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
AT_COMPILE([input.o], [-DYYDEBUG -c input.c])
|
AT_COMPILE([input.o], [-DYYDEBUG -c input.c])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
@@ -71,7 +71,7 @@ program: { $$ = ""; };
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y])
|
AT_BISON_CHECK([-o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -111,7 +111,7 @@ exp: MY_TOKEN;
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-y -o input.c input.y])
|
AT_BISON_CHECK([-y -o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -156,7 +156,7 @@ exp: MY_TOKEN;
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y])
|
AT_BISON_CHECK([-o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
|
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
@@ -527,7 +527,7 @@ exp:
|
|||||||
AT_BISON_OPTION_POPDEFS
|
AT_BISON_OPTION_POPDEFS
|
||||||
|
|
||||||
AT_BISON_CHECK([-o input.c input.y])
|
AT_BISON_CHECK([-o input.c input.y])
|
||||||
AT_COMPILE([input.o], [-c input.c])
|
AT_COMPILE([input.o])
|
||||||
AT_CLEANUP
|
AT_CLEANUP
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user