yacc tests: avoid a spurious failure with Sun C++ 5.9
authorStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 16 May 2012 14:26:39 +0000 (16:26 +0200)
committerStefano Lattarini <stefano.lattarini@gmail.com>
Wed, 16 May 2012 14:32:20 +0000 (16:32 +0200)
* t/yacc-cxx.sh (parse1.yy): When calling the 'getchar' function declared
in the #included <cstdio>, fully qualify it as std::getchar', to avoid
Sun C++ 5.9 erroring out with:
"parse1.yy", line 5: Error: The function "getc" must have a prototype.
* t/yacc-clean-cxx.sh (sub1/parsefoo.yxx): Likewise.

Signed-off-by: Stefano Lattarini <stefano.lattarini@gmail.com>
t/yacc-clean-cxx.sh
t/yacc-cxx.sh

index d8ee1c6..399f026 100755 (executable)
@@ -68,7 +68,8 @@ cat > sub1/parsefoo.yxx << 'END'
 %{
 // This file should contain valid C++ but invalid C.
 #include <cstdio>
-int yylex (void) { return (getchar ()); }
+// "std::" qualification required by Sun C++ 5.9.
+int yylex (void) { return std::getchar (); }
 void yyerror (const char *s) { return; }
 %}
 %%
index dfcc12a..41a25ec 100755 (executable)
@@ -46,7 +46,8 @@ cat > parse1.yy << 'END'
 // Valid C++, but deliberately invalid C.
 #include <cstdio>
 #include <cstdlib>
-int yylex (void) { return getchar (); }
+// "std::" qualification required by Sun C++ 5.9.
+int yylex (void) { return std::getchar (); }
 void yyerror (const char *s) { return; }
 %}
 %%