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.
This commit is contained in:
Akim Demaille
2018-08-15 18:10:16 +02:00
parent ef98967ada
commit 45ca5043ce

View File

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