bison-patches
[Top][All Lists]
Advanced

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

FYI: master: tests: fix minor issues


From: Akim Demaille
Subject: FYI: master: tests: fix minor issues
Date: Sun, 12 Aug 2018 08:45:40 +0200

commit ad42f960532830857e97302a7c31fe7b66432c6f
Author: Akim Demaille <address@hidden>
Date:   Sun Aug 12 07:53:28 2018 +0200

    tests: fix minor issues
    
    * tests/actions.at: Fix some log messages.
    Prefer #error to fprintf: it fixes the invalid use of yyoutput in
    %destructor, and it is an even stronger check: that the code is not
    even emitted.  The portability of #error is not really a problem here,
    since the point is anyway to have the compilation fail.

diff --git a/tests/actions.at b/tests/actions.at
index 94cf6f74..d5425d0b 100644
--- a/tests/actions.at
+++ b/tests/actions.at
@@ -564,11 +564,11 @@ AT_LALR1_CC_IF([typedef yy::location YYLTYPE;])[
   thing
 
 %destructor
-  { fprintf (stderr, "Freeing raise thing (address@hidden)\n", $$, RANGE 
(@$)); }
+  { fprintf (stderr, "Freeing nterm raise (address@hidden)\n", $$, RANGE 
(@$)); }
   raise
 
 %destructor
-  { fprintf (stderr, "Freeing check-spontaneous-errors thing 
(address@hidden)\n", $$, RANGE (@$)); }
+  { fprintf (stderr, "Freeing nterm check-spontaneous-errors 
(address@hidden)\n", $$, RANGE (@$)); }
   check-spontaneous-errors
 
 %destructor
@@ -1002,7 +1002,7 @@ AT_DATA_GRAMMAR([[input.y]],
 }
 
 %printer {
-  fprintf (yyoutput, "<*> printer should not be called.\n");
+  #error "<*> printer should not be used."
 } <*>
 
 %printer {
@@ -1020,7 +1020,7 @@ AT_DATA_GRAMMAR([[input.y]],
 } 'b' 'c'
 
 %destructor {
-  fprintf (yyoutput, "<*> destructor should not be called.\n");
+  #error "<*> destructor should not be used."
 } <*>
 
 %%
@@ -1094,7 +1094,7 @@ AT_DATA_GRAMMAR([[input.y]],
 %}
 
 %printer {
-  fprintf (yyoutput, "<> printer should not be called.\n");
+  #error "<> printer should not be used."
 } <>
 
 %union { int field0; int field1; int field2; }
@@ -1121,7 +1121,7 @@ AT_DATA_GRAMMAR([[input.y]],
 %destructor { fprintf (stdout, "'d' destructor.\n"); } 'd'
 
 %destructor {
-  fprintf (yyoutput, "<> destructor should not be called.\n");
+  #error "<> destructor should not be used."
 } <>
 
 %%
@@ -1222,7 +1222,7 @@ AT_DATA_GRAMMAR([[input]]$1[[.y]],
 }
 
 %destructor {
-  fprintf (yyoutput, "<]]not_kind[[> destructor should not be called.\n");
+  #error "<]]not_kind[[> destructor should not be used."
 } <]]not_kind[[>
 
 %token END 0
@@ -1234,7 +1234,7 @@ AT_DATA_GRAMMAR([[input]]$1[[.y]],
 } <]]kind[[>
 
 %printer {
-  fprintf (yyoutput, "<]]not_kind[[> printer should not be called.\n");
+  #error "<]]not_kind[[> printer should not be used."
 } <]]not_kind[[>
 
 ]]m4_if($1, 0, [[[
@@ -1482,10 +1482,10 @@ AT_DATA_GRAMMAR([[input.y]],
 # define LOCATION_PRINT(File, Loc)
 %}
 
-%printer { fprintf (yyoutput, "%d", @$); } <>
+%printer    { fprintf (yyoutput, "%d", @$); } <>
 %destructor { fprintf (stderr, "DESTROY %d\n", @$); } <>
-%printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
-%destructor { fprintf (yyoutput, "<*> destructor should not be called"); } <*>
+%printer    { #error "<*> printer should not be used" } <*>
+%destructor { #error "<*> destructor should not be used" } <*>
 
 %%
 
@@ -1506,19 +1506,19 @@ start:
 AT_BISON_OPTION_POPDEFS
 
 AT_BISON_CHECK([-o input.c input.y], 0,,
-[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
-input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
+[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
+input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
 input.y:33.3-23: warning: unset value: $$ [-Wother]
 input.y:32.3-23: warning: unused value: $3 [-Wother]
 ]])
 
 AT_BISON_CHECK([-fcaret -o input.c input.y], 0,,
-[[input.y:24.70-72: warning: useless %destructor for type <*> [-Wother]
- %printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
-                                                                      ^^^
-input.y:24.70-72: warning: useless %printer for type <*> [-Wother]
- %printer { fprintf (yyoutput, "<*> printer should not be called"); } <*>
-                                                                      ^^^
+[[input.y:24.57-59: warning: useless %destructor for type <*> [-Wother]
+ %printer    { #error "<*> printer should not be used" } <*>
+                                                         ^^^
+input.y:24.57-59: warning: useless %printer for type <*> [-Wother]
+ %printer    { #error "<*> printer should not be used" } <*>
+                                                         ^^^
 input.y:33.3-23: warning: unset value: $$ [-Wother]
    {           @$ = 4; } // Only used.
    ^^^^^^^^^^^^^^^^^^^^^




reply via email to

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