]> git.ipfire.org Git - thirdparty/automake.git/commitdiff
test: protect more yacc declarations against C vs. C++ linkage.
authorBogdan <bogdro_rep@gmx.us>
Wed, 7 Feb 2024 22:56:25 +0000 (14:56 -0800)
committerKarl Berry <karl@freefriends.org>
Wed, 7 Feb 2024 22:56:25 +0000 (14:56 -0800)
Fix for more of https://bugs.gnu.org/68832.

* t/yacc-clean-cxx.sh: more #ifdef of yylex, etc., following
https://debbugs.gnu.org/cgi/bugreport.cgi?bug=62886,
now for OpenIndiana. Specifically:
#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
* t/yacc-cxx.sh: likewise.
* t/yacc-d-cxx.sh: likewise.
* t/yacc-mix-c-cxx.sh: likewise.

t/yacc-clean-cxx.sh
t/yacc-cxx.sh
t/yacc-d-cxx.sh
t/yacc-mix-c-cxx.sh

index facd6dbc40dc45a807d7456ef14c164c44bda101..6af2047c0bb2f515b84f1a9cb899d5fcbfb18ebb 100644 (file)
@@ -70,9 +70,17 @@ cat > sub1/parsefoo.yxx << 'END'
 %{
 // This file should contain valid C++ but invalid C.
 #include <cstdio>
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C" {
+#endif
+
 // "std::" qualification required by Sun C++ 5.9.
 int yylex (void) { return std::getchar (); }
 void yyerror (const char *s) {}
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+}
+#endif
+
 %}
 %%
 x : 'x' { };
index f6b477c0d77af12be75fe603aaf8fc85e0da7581..3f891dac59db2be94ab0d382c3f4637128e32f67 100644 (file)
@@ -54,9 +54,16 @@ cat > parse1.yy << 'END'
 using std::exit;
 using std::free;
 using std::malloc;
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C" {
+#endif
 // "std::" qualification required by Sun C++ 5.9.
 int yylex (void) { return std::getchar (); }
 void yyerror (const char *s) {}
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+}
+#endif
+
 %}
 %%
 a : 'a' { exit(0); };
index 255e00a71e978fbe56b99a8c1bea61b98c152acb..556977c220f9ac43f58e0d51cd05f174e15e7085 100644 (file)
@@ -35,8 +35,14 @@ write_parse ()
     using std::free;
     using std::malloc;
     #include "$header"
+    #if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+    extern "C" {
+    #endif
     int yylex (void) { return 0; }
     void yyerror (const char *s) {}
+    #if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+    }
+    #endif
     %}
     %%
     x : 'x' {};
index 0e7e2e10425595216eb95d69b729364c2ba0eb13..d454fe244ebe2af95add117eebc8c681963f5d75 100644 (file)
@@ -54,8 +54,14 @@ END
 
 cat > p.y <<'END'
 %{
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C" {
+#endif
 int yylex (void) { int new = 0; return new; }
 void yyerror (const char *s) {}
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+}
+#endif
 %}
 %token ZARDOZ
 %%
@@ -93,8 +99,14 @@ using std::exit;
 using std::free;
 using std::malloc;
 #include "parse.hh"
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+extern "C" {
+#endif
 int yylex (void) { return 0; }
 void yyerror (const char *s) {}
+#if (defined __cplusplus) && ((!defined __sun) || (defined __EXTERN_C__))
+}
+#endif
 %}
 %token FOOBAR
 %%