]> git.saurik.com Git - bison.git/blobdiff - tests/calc.at
tests: remove useless location initializations
[bison.git] / tests / calc.at
index e4cb07f19c3365605d7b4956f0e96156d3b5c993..d912832f0ee87f9245f95049d0a6aa2638fc442f 100644 (file)
@@ -280,25 +280,10 @@ AT_SKEL_CC_IF(
 FILE *input;
 static int power (int base, int exponent);
 
-]AT_SKEL_CC_IF(,
-[static void yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
-                     AT_PARAM_IF([semantic_value *result, int *count, ])
-                     const char *s
-                     );])[
+]AT_YYERROR_DECLARE[
 ]AT_YYLEX_DECLARE_EXTERN[
 }
 
-]AT_SKEL_CC_IF([AT_LOCATION_TYPE_IF([], [
-/* The lalr1.cc skeleton, for backward compatibility, defines
-   a constructor for position that initializes the filename.  The
-   glr.cc skeleton does not (and in fact cannot: location/position
-   are stored in a union, from which objects with constructors are
-   excluded in C++. */
-%initial-action {
-  @$.initialize ();
-}
-])])[
-
 /* Bison Declarations */
 %token CALC_EOF 0 "end of input"
 %token <ival> NUM "number"
@@ -365,32 +350,11 @@ power (int base, int exponent)
       o << '-' << s.last.c - 1;
     return o;
   }
-]])
-AT_YYERROR_DEFINE],
-[/* A C error reporting function.  */
-static void
-yyerror (AT_YYERROR_ARG_LOC_IF([AT_YYLTYPE *llocp, ])
-         AT_PARAM_IF([semantic_value *result, int *count, ])
-         const char *s)
-{
-AT_PARAM_IF([(void) result; (void) count;])
-AT_YYERROR_SEES_LOC_IF([
-  fprintf (stderr, "%d.%d",
-           AT_LOC_FIRST_LINE, AT_LOC_FIRST_COLUMN);
-  if (AT_LOC_FIRST_LINE != AT_LOC_LAST_LINE)
-    fprintf (stderr, "-%d.%d",
-             AT_LOC_LAST_LINE,  AT_LOC_LAST_COLUMN - 1);
-  else if (AT_LOC_FIRST_COLUMN != AT_LOC_LAST_COLUMN - 1)
-    fprintf (stderr, "-%d",
-             AT_LOC_LAST_COLUMN - 1);
-  fprintf (stderr, ": ");])
-  fprintf (stderr, "%s\n", s);
-}])[
-
+]])])[
+]AT_YYERROR_DEFINE[
 ]AT_DEFINES_IF([],
 [AT_CALC_LEX
-AT_CALC_MAIN])[
-]])
+AT_CALC_MAIN])])
 
 AT_DEFINES_IF([AT_DATA_SOURCE([[calc-lex.c]AT_SKEL_CC_IF([[c]])],
 [[#include "calc.h]AT_SKEL_CC_IF([[h]])["
@@ -500,6 +464,23 @@ AT_CHECK([cat stderr], 0, [expout])
 ])
 
 
+# AT_CHECK_SPACES([FILE])
+# -----------------------
+# Make sure we did not introduce bad spaces.  Checked here because all
+# the skeletons are (or should be) exercized here.
+m4_define([AT_CHECK_SPACES],
+[AT_CHECK([$PERL -ne '
+  chomp;
+  print "$.: {$_}\n"
+    if (# No starting/ending empty lines.
+        (eof || $. == 1) && /^\s*$/
+        # No trailing space.  FIXME: not ready for "maint".
+        # || /\s$/
+        )' $1
+])dnl
+])
+
+
 # AT_CHECK_CALC([BISON-OPTIONS])
 # ------------------------------
 # Start a testing chunk which compiles `calc' grammar with
@@ -514,6 +495,8 @@ AT_BISON_OPTION_PUSHDEFS([$1])
 
 AT_DATA_CALC_Y([$1])
 AT_FULL_COMPILE([calc], AT_DEFINES_IF([[lex], [main]]))
+AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([cc], [c])])
+AT_DEFINES_IF([AT_CHECK_SPACES([calc.AT_SKEL_CC_IF([hh], [h])])])
 
 # Test the priorities.
 _AT_CHECK_CALC([$1],