Debian Codegraph @

macros/cxx_suggest_override.m4

raw
1 # Try to add option -Wsuggest-override to get a warning when an overriding virtual function
2 # is missing the override keyword.
3 # If the option is supported, $(W_SUGGEST_OVERRIDE) can be used in a *_CXXFLAGS variable
4 # of a Makefile.am file.
5 #
6 AC_DEFUN([CXX_SUGGEST_OVERRIDE], [
7
8 AC_MSG_CHECKING([if C++ compiler supports -Wsuggest-override])
9 saved_CXXFLAGS="$CXXFLAGS"
10 CXXFLAGS="-Wsuggest-override"
11 AC_COMPILE_IFELSE(
12 [AC_LANG_SOURCE([[int main() { return 0; }]])],
13 [
14 AC_MSG_RESULT(yes)
15 W_SUGGEST_OVERRIDE=-Wsuggest-override
16 AC_SUBST(W_SUGGEST_OVERRIDE)
17 ],
18 [
19 AC_MSG_RESULT(no)
20 ])
21 CXXFLAGS="$saved_CXXFLAGS"
22
23 ])