summaryrefslogblamecommitdiff
path: root/3rdparty/libconfig/extra/gen/clangwarnings.patch
blob: ecae69c0e04f46bfa6daac2d694f6e925c3c4452 (plain) (tree)
1
2
3
4
5
6
7
8



                                  

                                                                                      

                    


                                                          
                                                                                       
 
                                      
                  








                                  
 
                              
 
                                                                        
                                                              
         
 

                                                                                                        

                                                                   
  
diff --git a/grammar.c b/grammar.c
index 3595578..26444f8 100644
--- a/grammar.c
+++ b/grammar.c
@@ -1084,9 +1084,7 @@ void libconfig_yyerror(void *scanner, struct parse_context *ctx,
   YYUSE (scanner);
   YYUSE (ctx);
   YYUSE (scan_ctx);
-  if (!yymsg)
-    yymsg = "Deleting";
-  YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
+  YY_SYMBOL_PRINT (yymsg != NULL ? yymsg : "Deleting", yytype, yyvaluep, yylocationp);

   YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
   YYUSE (yytype);
diff --git a/scanner.c b/scanner.c
index 60882db..8b8af33 100644
--- a/scanner.c
+++ b/scanner.c
@@ -21,6 +21,7 @@
 #include <string.h>
 #include <errno.h>
 #include <stdlib.h>
+#include <assert.h>

 /* end standard C headers. */

@@ -1702,6 +1703,8 @@ static int yy_get_next_buffer (yyscan_t yyscanner)
             yy_create_buffer( yyin, YY_BUF_SIZE , yyscanner);
 	}

+	assert(YY_CURRENT_BUFFER != NULL); // Fixes compiler warning -Wnull-dereference on gcc-6 and -O3
+
 	yy_init_buffer( YY_CURRENT_BUFFER, input_file , yyscanner);
 	yy_load_buffer_state( yyscanner );
 }