From bd07c76b0abaa8bcd4f34435169cb1d4dbc8abd0 Mon Sep 17 00:00:00 2001 From: Akim Demaille Date: Wed, 15 Aug 2018 18:35:46 +0200 Subject: [PATCH] c++: avoid GCC 8 warnings GCC 8 issues warnings whose root cause was a bit hard to find. calc.cc: In member function 'virtual int yy::parser::parse()': calc.cc:810:18: warning: '*((void*)& +8)' may be used uninitialized in this function [-Wmaybe-uninitialized] , location (l) ^ calc.cc: In member function 'void yy::parser::yypush_(const char*, yy::parser::stack_symbol_type&)': calc.cc:810:18: warning: '*((void*)& +8)' may be used uninitialized in this function [-Wmaybe-uninitialized] , location (l) ^ calc.cc: In member function 'void yy::parser::yypush_(const char*, yy::parser::state_type, yy::parser::symbol_type&)': calc.cc:810:18: warning: '*((void*)& +8)' may be used uninitialized in this function [-Wmaybe-uninitialized] , location (l) ^ The problem is with locations that don't have a constructor, such as Span (in calc.cc) which is POD. It is POD on purpose: so that we can use that structure to test glr.cc which cannot use non POD in its (C) stacks. * data/c++.m4 (basic_symbol): Also ensure that 'location' is initialized. --- data/c++.m4 | 3 ++- gnulib | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/data/c++.m4 b/data/c++.m4 index 3eca8009..90679345 100644 --- a/data/c++.m4 +++ b/data/c++.m4 @@ -296,7 +296,8 @@ m4_define([b4_public_types_define], // basic_symbol. template - ]b4_parser_class_name[::basic_symbol::basic_symbol () + ]b4_parser_class_name[::basic_symbol::basic_symbol ()]b4_locations_if([ + : location ()])[ {} template diff --git a/gnulib b/gnulib index 8635df0a..dd1a129e 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 8635df0ac89e4b1e77322126ecff67e6bca62bd8 +Subproject commit dd1a129ef62d10b1eeb4b40ad39771b93f368cec