diff options
author | Akim Demaille <akim.demaille@gmail.com> | 2019-01-14 19:57:02 +0100 |
---|---|---|
committer | Akim Demaille <akim.demaille@gmail.com> | 2019-01-15 07:10:29 +0100 |
commit | a049509d0437046e57a0e96f71452ddb33f8eecc (patch) | |
tree | c523c4fd42c7c5b7ff4dc0bf742e93aef4b83b6b /configure.ac | |
parent | 7c5e508b3984cbebdc7b5abf741410a5e5c6051c (diff) | |
download | bison-a049509d0437046e57a0e96f71452ddb33f8eecc.tar.gz |
c++: avoid -Wundefined-func-template warnings from clang
Reported by Derek Clegg.
http://lists.gnu.org/archive/html/bug-bison/2019-01/msg00006.html
Clang does not like this:
template <typename D>
struct basic_symbol : D
{
basic_symbol();
};
struct by_type {};
struct symbol_type : basic_symbol<by_type>
{
symbol_type(){}
};
It gives:
$ clang++-mp-7.0 -Wundefined-func-template foo.cc -c
foo.cc:11:3: warning: instantiation of function 'basic_symbol<by_type>::basic_symbol'
required here, but no definition is available [-Wundefined-func-template]
symbol_type(){}
^
foo.cc:4:3: note: forward declaration of template entity is here
basic_symbol();
^
foo.cc:11:3: note: add an explicit instantiation declaration to suppress this warning
if 'basic_symbol<by_type>::basic_symbol' is explicitly instantiated in
another translation unit
symbol_type(){}
^
1 warning generated.
The same applies for the basic_symbol's destructor and `clear()`.
* configure.ac (warn_cxx): Add -Wundefined-func-template.
This triggered one failure in the test suite:
* tests/headers.at (Sane headers): here, where we check that we can
compile the generated headers in other compilation units than the
parser's.
Add a variant type to make sure that basic_symbol and symbol_type are
properly generated in this case.
* data/skeletons/c++.m4 (basic_symbol): Inline the definitions of the
destructor and of `clear` in the class definition.
Diffstat (limited to 'configure.ac')
-rw-r--r-- | configure.ac | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/configure.ac b/configure.ac index e60af602..b7ba45dc 100644 --- a/configure.ac +++ b/configure.ac @@ -96,7 +96,8 @@ AM_CONDITIONAL([ENABLE_GCC_WARNINGS], [test "$enable_gcc_warnings" = yes]) if test "$enable_gcc_warnings" = yes; then warn_common='-Wall -Wextra -Wno-sign-compare -Wcast-align -fparse-all-comments -Wdocumentation - -Wformat -Wnull-dereference -Wpointer-arith -Wshadow -Wwrite-strings' + -Wformat -Wnull-dereference -Wpointer-arith -Wshadow + -Wundefined-func-template -Wwrite-strings' warn_c='-Wbad-function-cast -Wstrict-prototypes' warn_cxx='-Wextra-semi -Wnoexcept' # Warnings for the test suite only. |