bison-patches
[Top][All Lists]
Advanced

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

FYI: tests: avoid compiler warnings


From: Akim Demaille
Subject: FYI: tests: avoid compiler warnings
Date: Wed, 15 Aug 2018 19:37:55 +0200

Installed in master and maint.

commit 45ca5043ce93f7cdcb97c65ed9f9a549ca01c1da
Author: Akim Demaille <address@hidden>
Date:   Wed Aug 15 18:10:16 2018 +0200

    tests: avoid compiler warnings
    
    * tests/calc.at (AT_CALC_MAIN): Declare yyparse and operator<< in an
    unnamed namespace to avoid "not declared" warnings (clang
    -Weverything).
    Remove useless prototypes.

diff --git a/tests/calc.at b/tests/calc.at
index 39a54e97..3d83ba72 100644
--- a/tests/calc.at
+++ b/tests/calc.at
@@ -49,6 +49,8 @@ m4_pushdef([AT_CALC_MAIN],
 #include <unistd.h>
 
 AT_SKEL_CC_IF([[
+namespace
+{
   /* A C++ ]AT_NAME_PREFIX[parse that simulates the C signature.  */
   int
   ]AT_NAME_PREFIX[parse (]AT_PARAM_IF([semantic_value *result, int *count]))[
@@ -59,6 +61,7 @@ int
   #endif
     return parser.parse ();
   }
+}
 ]])[
 
 semantic_value global_result = 0;
@@ -105,8 +108,6 @@ m4_pushdef([AT_CALC_LEX],
 [[#include <ctype.h>
 
 ]AT_YYLEX_DECLARE_EXTERN[
-static int get_char (]AT_YYLEX_FORMALS[);
-static void unget_char (]AT_YYLEX_PRE_FORMALS[ int c);
 
 ]AT_LOCATION_IF([
 static AT_YYLTYPE last_yylloc;
@@ -322,7 +323,7 @@ exp:
 ;
 %%
 
-static int
+int
 power (int base, int exponent)
 {
   int res = 1;
@@ -334,6 +335,8 @@ power (int base, int exponent)
 
 ]AT_SKEL_CC_IF(
 [AT_LOCATION_TYPE_IF([[
+namespace
+{
   std::ostream&
   operator<< (std::ostream& o, const Span& s)
   {
@@ -344,6 +347,7 @@ power (int base, int exponent)
       o << '-' << s.last.c - 1;
     return o;
   }
+}
 ]])])[
 ]AT_YYERROR_DEFINE[
 ]AT_DEFINES_IF([],




reply via email to

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