bison-patches
[Top][All Lists]
Advanced

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

tests: Apple clang issues warning on C++11 features


From: Akim Demaille
Subject: tests: Apple clang issues warning on C++11 features
Date: Sat, 25 Sep 2021 11:51:51 +0200

Part of 3.8.2.

commit 80ebbe733093aa93588cadfc2e37b01f824fc493
Author: Akim Demaille <akim.demaille@gmail.com>
Date:   Sat Sep 25 08:46:33 2021 +0200

    tests: Apple clang issues warning on C++11 features
    
    $ cat /tmp/foo.cc
    using foo = int;
    foo f;
    $ clang++ -Wc++11-extensions -c /tmp/foo.cc
    /tmp/foo.cc:1:13: warning: alias declarations are a C++11 extension 
[-Wc++11-extensions]
    using foo = int;
                ^
    1 warning generated.
    $ clang++ --version
    Apple clang version 11.0.0 (clang-1100.0.33.17)
    Target: x86_64-apple-darwin18.7.0
    Thread model: posix
    InstalledDir: 
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
    
    * tests/local.at (AT_COMPILE_CXX): Make sure -std=c++11 is passed when
    running glr2.cc.  It may be overridden by another flag in CXXFLAGS
    afterwards.

diff --git a/tests/headers.at b/tests/headers.at
index f107643a..766d33f8 100644
--- a/tests/headers.at
+++ b/tests/headers.at
@@ -386,7 +386,11 @@ m4_pushdef([AT_TEST],
 # Do this late, so that other checks have been performed.
 AT_SKIP_IF_CANNOT_LINK_C_AND_CXX
 
+# The header generated by glr2.cc requires C++11.  Push the options to
+# prepare AT_COMPILE_CXX.
+AT_BISON_OPTION_PUSHDEFS([%skeleton "glr2.cc"])
 AT_COMPILE_CXX([parser], [[x[1-9a-d].o -DCC_IS_CXX=$CC_IS_CXX main.cc]])
+AT_BISON_OPTION_POPDEFS
 AT_PARSER_CHECK([parser], [0], [[expout]])
 
 m4_popdef([AT_TEST])
diff --git a/tests/local.at b/tests/local.at
index 1138df47..3ba67a54 100644
--- a/tests/local.at
+++ b/tests/local.at
@@ -1358,13 +1358,19 @@ m4_define([AT_COMPILE],
 # 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.
+#
+# glr2.cc require C++11.
 m4_define([AT_COMPILE_CXX],
 [AT_KEYWORDS([c++])
 AT_SKIP_IF([[! $BISON_CXX_WORKS]])
 m4_ifdef([AT_GLR2_CC_IF],
   [AT_GLR2_CC_IF([AT_SKIP_IF([[test x"$CXX11_CXXFLAGS" == x]])])])
 AT_CHECK(m4_join([ ],
-                 [$CXX $CXXFLAGS $CPPFLAGS $3],
+                 [$CXX],
+                 [$CPPFLAGS],
+                 [m4_ifdef([AT_GLR2_CC_IF], 
[AT_GLR2_CC_IF([$CXX11_CXXFLAGS])])],
+                 [$CXXFLAGS],
+                 [$3],
                  [m4_bmatch([$1], [[.]], [-c], [$LDFLAGS])],
                  [-o $1],
                  [m4_default([$2], [m4_bpatsubst([$1], [\.o$]).cc])],




reply via email to

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