bison-patches
[Top][All Lists]
Advanced

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

FYI: tests: fix warnings in push mode


From: Akim Demaille
Subject: FYI: tests: fix warnings in push mode
Date: Wed, 15 Aug 2018 19:40:45 +0200

Installed in master and maint.

commit c53b3861ad37f36da469ba8ca921cb4e6e8794c3
Author: Akim Demaille <address@hidden>
Date:   Wed Aug 15 18:58:03 2018 +0200

    tests: fix warnings in push mode
    
    Fix warning with GCC 8, -DNDEBUG.
    
        422. push.at:83: testing Multiple impure instances ...
        input.y: In function 'main':
        input.c:1022:12: error: potential null pointer dereference 
[-Werror=null-dereference]
           if (!yyps->yynew && yyps->yyss != yyps->yyssa)
                ~~~~^~~~~~~
    
    * data/yacc.c (pstate_delete): Do nothing if called on null pointer.

diff --git a/data/yacc.c b/data/yacc.c
index 7c298a1a..e72b098b 100644
--- a/data/yacc.c
+++ b/data/yacc.c
@@ -1326,6 +1326,8 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
 ]b4_function_define([[yypstate_delete]], [[void]],
                    [[[yypstate *yyps]], [[yyps]]])[
 {
+  if (yyps)
+    {
 #ifndef yyoverflow
       /* If the stack was reallocated but the parse did not complete, then the
          stack still needs to be freed.  */
@@ -1337,6 +1339,7 @@ b4_function_define([[yyparse]], [[int]], b4_parse_param)[
       free (yyps);]b4_pure_if([], [[
       yypstate_allocated = 0;]])[
     }
+}
 ]b4_pure_if([[
 #define ]b4_prefix[nerrs yyps->]b4_prefix[nerrs]])[
 #define yystate yyps->yystate
diff --git a/doc/bison.texi b/doc/bison.texi
index 2882506b..2b21b7bc 100644
--- a/doc/bison.texi
+++ b/doc/bison.texi
@@ -13114,7 +13114,7 @@ Obsoleted by @code{%printer}.
 The function to delete a parser instance, produced by Bison in push mode;
 call this function to delete the memory associated with a parser.
 @xref{Parser Delete Function, ,The Parser Delete Function
address@hidden
address@hidden  Does nothing when called with a null pointer.
 (The current push parsing interface is experimental and may evolve.
 More user feedback will help to stabilize it.)
 @end deffn




reply via email to

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