summaryrefslogtreecommitdiff
path: root/configure.ac
diff options
context:
space:
mode:
authorAkim Demaille <akim.demaille@gmail.com>2019-01-20 08:23:41 +0100
committerAkim Demaille <akim.demaille@gmail.com>2019-01-20 18:46:44 +0100
commitec08b369ec1b348d8eeeffd3d48cb7138a918437 (patch)
tree6caa2c155f01d521effc72f0de6c54020b735762 /configure.ac
parent05b70f47e8583d8bf601210dcef3542cde1d9542 (diff)
downloadbison-ec08b369ec1b348d8eeeffd3d48cb7138a918437.tar.gz
c++: address -Wweak-vtables warnings
Reported by Derek Clegg http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00021.html aux/parser-internal.h:429:12: error: 'syntax_error' has no out-of-line virtual method definitions; its vtable will be emitted in every translation unit [-Werror,-Wweak-vtables] struct syntax_error : std::runtime_error To avoid this warning, we need syntax_error to have a virtual function defined in a compilation unit. Let it be the destructor. To comply with C++98, this dtor should be 'throw()'. Merely making YY_NOEXCEPT be 'throw()' in C++98 triggers errors (http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00022.html), so let's introduce YY_NOTHROW and flag only ~syntax_error with it. Also, since we now have an explicit dtor, we need to provide an copy ctor. * configure.ac (warn_cxx): Add -Wweak-vtables. * data/skeletons/c++.m4 (YY_NOTHROW): New. (syntax_error): Declare the dtor, and define the copy ctor. * data/skeletons/glr.cc, data/skeletons/lalr1.cc (~syntax_error): Define.
Diffstat (limited to 'configure.ac')
-rw-r--r--configure.ac2
1 files changed, 1 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac
index a3a471af..1b5343e7 100644
--- a/configure.ac
+++ b/configure.ac
@@ -100,7 +100,7 @@ if test "$enable_gcc_warnings" = yes; then
-Wpointer-arith -Wshadow
-Wwrite-strings'
warn_c='-Wbad-function-cast -Wstrict-prototypes'
- warn_cxx='-Wextra-semi -Wnoexcept -Wundefined-func-template'
+ warn_cxx='-Wextra-semi -Wnoexcept -Wundefined-func-template -Wweak-vtables'
# Warnings for the test suite only.
#
# -fno-color-diagnostics: Clang's use of colors in the error