bison-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

style: tests: factor file extension computations


From: Akim Demaille
Subject: style: tests: factor file extension computations
Date: Sat, 6 Oct 2018 17:25:42 +0200

commit 53bde230c6af83c0648ba49669ce6711d9a8f6e7
Author: Akim Demaille <address@hidden>
Date:   Sat Oct 6 16:18:58 2018 +0200

    style: tests: factor file extension computations
    
    * tests/local.at (AT_LANG_HDR): New.
    * tests/calc.at, tests/headers.at, tests/synclines.at: Use it, and
    AT_LANG_EXT.

diff --git a/tests/calc.at b/tests/calc.at
index 5d270dd8..17cecdc3 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -495,9 +495,7 @@ AT_BISON_OPTION_PUSHDEFS([$1])
 
 AT_DATA_CALC_Y([$1])
 AT_FULL_COMPILE([calc], AT_DEFINES_IF([[lex], [main]]), [], [$2])
-AT_CHECK_SPACES(m4_join([ ],
-                        [calc.AT_SKEL_CC_IF([cc], [c])],
-                        [AT_DEFINES_IF([calc.AT_SKEL_CC_IF([hh], [h])])]))
+AT_CHECK_SPACES([calc.AT_LANG_EXT AT_DEFINES_IF([calc.AT_LANG_HDR])])
 
 # Test the priorities.
 _AT_CHECK_CALC([$1],
diff --git a/tests/headers.at b/tests/headers.at
index e6e747b0..490cf1d4 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -143,7 +143,7 @@ exp:
 ]AT_YYLEX_DEFINE(["x"])[
 ]])
 
-AT_BISON_CHECK([-d -o input.AT_SKEL_CC_IF([cc], [c]) input.y])
+AT_BISON_CHECK([-d -o input.AT_LANG_EXT input.y])
 
 AT_LANG_COMPILE([input.o])
 
@@ -154,10 +154,10 @@ AT_MAIN_DEFINE
 
 # Check that the headers are self-contained, and protected against
 # multiple inclusions.  While at it, check they are sane for C++.
-for h in *.AT_SKEL_CC_IF([hh], [h])
+for h in *.AT_LANG_HDR
 do
   # No shell expansion with AT_DATA.
-  cat >$h.AT_SKEL_CC_IF([cc], [c]) <<EOF
+  cat >$h.AT_LANG_EXT <<EOF
 AT_DATA_SOURCE_PROLOGUE
 #include "$h"
 #include "$h"
@@ -235,7 +235,7 @@ exp:
 ]AT_YYLEX_DEFINE(["$1"])[
 ]])
 
-AT_BISON_CHECK([-d -o $1.AT_SKEL_CC_IF([cc], [c]) $1.y])
+AT_BISON_CHECK([-d -o $1.AT_LANG_EXT $1.y])
 
 AT_LANG_COMPILE([$1.o])
 AT_CHECK([[echo "$1" >>expout]])
diff --git a/tests/local.at b/tests/local.at
index 9a0bec15..cc4abc6d 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -833,6 +833,14 @@ m4_define([AT_LANG_EXT(c++)],  [cc])
 m4_define([AT_LANG_EXT(java)], [java])
 
 
+# AT_LANG_HDR
+# -----------
+# The header file extension corresponding to the language: c, cc.
+m4_define([AT_LANG_HDR],  [AT_LANG_DISPATCH([$0], $@)])
+m4_define([AT_LANG_HDR(c)],    [h])
+m4_define([AT_LANG_HDR(c++)],  [hh])
+
+
 # AT_FULL_COMPILE(OUTPUT, [OTHER1], [OTHER2], [EXTRA-COMPILER-FLAGS)
 # ------------------------------------------------------------------
 # Compile OUTPUT.y to OUTPUT.c, OUTPUT.cc, or OUTPUT.java, and then
diff --git a/tests/synclines.at b/tests/synclines.at
index fb1b6725..95636c68 100644
--- a/tests/synclines.at
+++ b/tests/synclines.at
@@ -452,7 +452,7 @@ AT_DATA_GRAMMAR([input.y],
 %%
 exp: '0'
 ]])
-AT_BISON_CHECK([--no-lines -o input.AT_SKEL_CC_IF([cc], [c]) -d input.y])
+AT_BISON_CHECK([--no-lines -o input.AT_LANG_EXT -d input.y])
 AT_CHECK([[grep '#line' ]AT_SKEL_CC_IF([*.cc *.hh], [*.c *.h])], 1)
 AT_BISON_OPTION_POPDEFS
 




reply via email to

[Prev in Thread] Current Thread [Next in Thread]