build: do not try to mimic AX_COMPILER_FLAGS
It's easier to use the warning_level. It's not equivalent, but it's good
enough and it simplifies a lot the meson.build file, and is what is
recommended to do.
There was a Meson warning:
WARNING: Consider using the builtin warning_level option instead of
adding warning flags by hand.
I've tried warning_level=3 first, but it gives warnings of the following
types:
- [-Wpedantic] (some of them are easy to fix and it would be nice to fix
them).
- [-Woverlength-strings] in dh-resources.c.
Sébastien Wilmet
4 years ago
5 | 5 | project( |
6 | 6 | 'devhelp', 'c', |
7 | 7 | meson_version : '>= 0.47', |
8 | version : '3.34.0' | |
8 | version : '3.34.0', | |
9 | default_options : ['warning_level=2'] | |
9 | 10 | ) |
10 | 11 | |
11 | 12 | GNOME = import('gnome') |
98 | 99 | language : 'c' |
99 | 100 | ) |
100 | 101 | |
101 | ##### | |
102 | # CFLAGS | |
103 | # (This is one of the ugly parts of Meson, currently.) | |
104 | # The same as the AX_COMPILER_FLAGS Autotools macro. | |
105 | ||
102 | # Additional CFLAGS. | |
106 | 103 | warning_cflags = [ |
107 | '-fno-strict-aliasing', | |
108 | '-Wall', | |
109 | '-Wextra', | |
110 | '-Wundef', | |
111 | '-Wnested-externs', | |
112 | '-Wwrite-strings', | |
113 | '-Wpointer-arith', | |
114 | '-Wmissing-declarations', | |
115 | '-Wmissing-prototypes', | |
116 | '-Wstrict-prototypes', | |
117 | '-Wredundant-decls', | |
118 | 104 | '-Wno-unused-parameter', |
119 | 105 | '-Wno-missing-field-initializers', |
120 | '-Wdeclaration-after-statement', | |
121 | '-Wformat=2', | |
122 | '-Wold-style-definition', | |
123 | '-Wcast-align', | |
124 | '-Wformat-nonliteral', | |
125 | '-Wformat-security', | |
126 | '-Wsign-compare', | |
127 | '-Wstrict-aliasing', | |
128 | '-Wshadow', | |
129 | '-Winline', | |
130 | '-Wpacked', | |
131 | '-Wmissing-format-attribute', | |
132 | '-Wmissing-noreturn', | |
133 | '-Winit-self', | |
134 | '-Wredundant-decls', | |
135 | '-Wmissing-include-dirs', | |
136 | '-Wunused-but-set-variable', | |
137 | '-Warray-bounds', | |
138 | '-Wimplicit-function-declaration', | |
139 | '-Wreturn-type', | |
140 | '-Wswitch-enum', | |
141 | '-Wswitch-default', | |
142 | '-Wduplicated-cond', | |
143 | '-Wduplicated-branches', | |
144 | '-Wlogical-op', | |
145 | '-Wrestrict', | |
146 | '-Wnull-dereference', | |
147 | '-Wjump-misses-init', | |
148 | '-Wdouble-promotion' | |
149 | 106 | ] |
150 | ||
151 | 107 | c_compiler = meson.get_compiler('c') |
152 | 108 | supported_warning_cflags = c_compiler.get_supported_arguments(warning_cflags) |
153 | 109 | add_project_arguments(supported_warning_cflags, language : 'c') |
154 | ##### end CFLAGS | |
155 | 110 | |
156 | 111 | subdir('data') |
157 | 112 | subdir('plugins/gedit-plugin') |