automake-commit
[Top][All Lists]
Advanced

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

[automake-commit] branch master updated: tests: fix yacc C++ tests with


From: Mike Frysinger
Subject: [automake-commit] branch master updated: tests: fix yacc C++ tests with some C++ compilers
Date: Wed, 23 Feb 2022 23:30:06 -0500

This is an automated email from the git hooks/post-receive script.

vapier pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=13ae585a0184a4c0113fd4f3a19a0cedf1cfe5c2

The following commit(s) were added to refs/heads/master by this push:
     new 13ae585a0 tests: fix yacc C++ tests with some C++ compilers
13ae585a0 is described below

commit 13ae585a0184a4c0113fd4f3a19a0cedf1cfe5c2
Author: Mike Frysinger <vapier@gentoo.org>
AuthorDate: Sun Feb 20 14:28:11 2022 -0500

    tests: fix yacc C++ tests with some C++ compilers
    
    Fixes automake bug https://bugs.gnu.org/20031.
    
    The C++ standard does not require symbols be placed into the global
    namespace, just in the std namespace.  The GNU implementation will
    place symbols in both.  For our specific code, we don't care either.
    
    Unfortunately, it looks like generated flex code assumes that some
    stdlib.h symbols (free, malloc, exit) are in the global namespace,
    even when compiling for C++.  So when we include <cstdlib> but not
    <stdlib.h>, we might not get the symbols in the global namespace.
    
    We can workaround this by including stdlib.h in these tests without
    invalidating the point of the tests in general.
    
    * t/yacc-cxx.sh: Include stdlib.h.
    * t/yacc-d-cxx.sh: Likewise.
    * t/yacc-mix-c-cxx.sh: Likewise.
---
 t/yacc-cxx.sh       | 3 +++
 t/yacc-d-cxx.sh     | 3 +++
 t/yacc-mix-c-cxx.sh | 4 ++++
 3 files changed, 10 insertions(+)

diff --git a/t/yacc-cxx.sh b/t/yacc-cxx.sh
index 9dd9aabf7..33e73cbc0 100644
--- a/t/yacc-cxx.sh
+++ b/t/yacc-cxx.sh
@@ -43,6 +43,9 @@ END
 
 cat > parse1.yy << 'END'
 %{
+// Include C header to provide global symbols that flex assumes.
+// https://bugs.gnu.org/20031
+#include <stdlib.h>
 // Valid C++, but deliberately invalid C.
 #include <cstdio>
 #include <cstdlib>
diff --git a/t/yacc-d-cxx.sh b/t/yacc-d-cxx.sh
index ce7a9b123..b6390a67a 100644
--- a/t/yacc-d-cxx.sh
+++ b/t/yacc-d-cxx.sh
@@ -26,6 +26,9 @@ write_parse ()
   header=$1
   unindent <<END
     %{
+    // Include C header to provide global symbols that flex assumes.
+    // https://bugs.gnu.org/20031
+    #include <stdlib.h>
     // Valid C++, but deliberately invalid C.
     #include <cstdlib>
     #include "$header"
diff --git a/t/yacc-mix-c-cxx.sh b/t/yacc-mix-c-cxx.sh
index eb02d4cd5..475a8e9f5 100644
--- a/t/yacc-mix-c-cxx.sh
+++ b/t/yacc-mix-c-cxx.sh
@@ -82,6 +82,10 @@ END
 
 cat > parse.yy <<'END'
 %{
+// Include C header to provide global symbols that flex assumes.
+// https://bugs.gnu.org/20031
+#include <stdlib.h>
+// Valid C++, but deliberately invalid C.
 #include <cstdlib>
 #include "parse.hh"
 int yylex (void) { return 0; }



reply via email to

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