996
|
1 # - Check if the C compiler supports a set of warning flags.
|
|
2 # CFUNGE_CHECK_WARNING_FLAGS()
|
|
3 #
|
|
4 # Will use add_definitions() to add the flags if they are supported.
|
|
5 #
|
|
6
|
|
7 # cfunge - A standard-conforming Befunge93/98/109 interpreter in C.
|
|
8 # Copyright (C) 2008 Arvid Norlander <anmaster AT tele2 DOT se>
|
|
9 #
|
|
10 # This program is free software: you can redistribute it and/or modify
|
|
11 # it under the terms of the GNU General Public License as published by
|
|
12 # the Free Software Foundation, either version 3 of the License, or
|
|
13 # (at the proxy's option) any later version. Arvid Norlander is a
|
|
14 # proxy who can decide which future versions of the GNU General Public
|
|
15 # License can be used.
|
|
16 #
|
|
17 # This program is distributed in the hope that it will be useful,
|
|
18 # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
19 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
20 # GNU General Public License for more details.
|
|
21 #
|
|
22 # You should have received a copy of the GNU General Public License
|
|
23 # along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
24
|
|
25 include(CfungeCheckCflag)
|
|
26
|
|
27 macro(CFUNGE_CHECK_WARNING_FLAGS)
|
|
28 if (CMAKE_COMPILER_IS_GNUCC)
|
|
29 # Not all GCC versions support all of these flags.
|
|
30 CFUNGE_CHECK_CFLAG(Wall -Wall)
|
|
31 CFUNGE_CHECK_CFLAG(Wextra -Wextra)
|
|
32 CFUNGE_CHECK_CFLAG(pedantic -pedantic)
|
|
33
|
|
34 CFUNGE_CHECK_CFLAG(Wwrite-strings -Wwrite-strings)
|
|
35
|
|
36 CFUNGE_CHECK_CFLAG(Wcast-align -Wcast-align)
|
|
37 CFUNGE_CHECK_CFLAG(Wcast-qual -Wcast-qual)
|
|
38 CFUNGE_CHECK_CFLAG(Wbad-function-cast -Wbad-function-cast)
|
|
39
|
|
40 CFUNGE_CHECK_CFLAG(Wstrict-prototypes -Wstrict-prototypes)
|
|
41 CFUNGE_CHECK_CFLAG(Wmissing-prototypes -Wmissing-prototypes)
|
|
42 CFUNGE_CHECK_CFLAG(Wmissing-declarations -Wmissing-declarations)
|
|
43 CFUNGE_CHECK_CFLAG(Wold-style-definition -Wold-style-definition)
|
|
44
|
|
45 CFUNGE_CHECK_CFLAG(Wredundant-decls -Wredundant-decls)
|
|
46 CFUNGE_CHECK_CFLAG(Wnested-externs -Wnested-externs)
|
|
47 CFUNGE_CHECK_CFLAG(Wdeclaration-after-statement -Wdeclaration-after-statement)
|
|
48
|
|
49 CFUNGE_CHECK_CFLAG(Wshadow -Wshadow)
|
|
50 CFUNGE_CHECK_CFLAG(Wundef -Wundef)
|
|
51 CFUNGE_CHECK_CFLAG(Wpacked -Wpacked)
|
|
52 CFUNGE_CHECK_CFLAG(Wfloat-equal -Wfloat-equal)
|
|
53
|
|
54 CFUNGE_CHECK_CFLAG(Wstrict-aliasing_2 -Wstrict-aliasing=2)
|
|
55 #CFUNGE_CHECK_CFLAG(Wstrict-overflow_5 -Wstrict-overflow=5)
|
|
56 CFUNGE_CHECK_CFLAG(Wformat_2 -Wformat=2)
|
|
57
|
|
58 CFUNGE_CHECK_CFLAG(Wmissing-noreturn -Wmissing-noreturn)
|
|
59 CFUNGE_CHECK_CFLAG(Wmissing-format-attribute -Wmissing-format-attribute)
|
|
60
|
|
61 CFUNGE_CHECK_CFLAG(Winit-self -Winit-self)
|
|
62 # GCC 4.1(?) or later
|
|
63 CFUNGE_CHECK_CFLAG(Wunsafe-loop-optimizations -Wunsafe-loop-optimizations)
|
|
64 CFUNGE_CHECK_CFLAG(Wmissing-include-dirs -Wmissing-include-dirs)
|
|
65
|
|
66 CFUNGE_CHECK_CFLAG(Wunused-parameter -Wunused-parameter)
|
|
67 # These are part of -Wall in GCC 4.3, but not in some older versions.
|
|
68 CFUNGE_CHECK_CFLAG(Wunused-function -Wunused-function)
|
|
69 CFUNGE_CHECK_CFLAG(Wunused-label -Wunused-label)
|
|
70 CFUNGE_CHECK_CFLAG(Wunused-value -Wunused-value)
|
|
71 CFUNGE_CHECK_CFLAG(Wunused-variable -Wunused-variable)
|
|
72 CFUNGE_CHECK_CFLAG(Wimplicit -Wimplicit)
|
|
73 CFUNGE_CHECK_CFLAG(Wparentheses -Wparentheses)
|
|
74 # Part of -pedantic in 4.3
|
|
75 CFUNGE_CHECK_CFLAG(Wpointer-arith -Wpointer-arith)
|
|
76
|
|
77 # Maintainer flags. Gives lots of false positives.
|
|
78 # add_definitions(-Wunreachable-code -fno-inline
|
|
79 # -fno-inline-functions-called-once -fno-inline-functions
|
|
80 # -fkeep-inline-functions -Wno-inline)
|
|
81 # Even more false positives
|
|
82 #add_definitions(-Wunreachable-code)
|
|
83 # Only with this meaning in GCC 4.3 (and false positives):
|
|
84 # -Wconversion
|
|
85 endif (CMAKE_COMPILER_IS_GNUCC)
|
|
86 endmacro(CFUNGE_CHECK_WARNING_FLAGS)
|