Commit Graph

10 Commits

Author SHA1 Message Date
Ben Chan
9dac5ece77 build: make compiler warning options compatible with clang
This patch updates m4/compiler-warnings.m4 as follows to make it more
compatible with clang:

* clang doesn't support -Wunused-but-set-variable, which can be replaced
  with -Wunused-variable as the latter covers unused variables with or
  without an assigned value and is supported by gcc and clang.

* -Wno-unused-function is added to let clang ignore unused functions that
  are auto-generated.
2019-04-05 08:02:14 +00:00
Dan Williams
88fac7f14a build: fix -Wunused-but-set-variable support and handle clang better
By default the build used -Wno-unused-but-set-variable but that's
clearly not what we want. Fix those problems.

When using clang, the compiler doesn't error on unknown compile
options, so let's add -Werror to the checking too.

CC='clang'
configure:3408: checking for gcc
configure:3435: result: clang
...
configure:17644: checking whether gcc understands -Wno-unused-but-set-variable
configure:17657: clang -c -Wall -std=gnu89 -g -O2 -Wmissing-declarations -Wmissing-prototypes -Wdeclaration-after-statement -Wstrict-prototypes -Wno-unused-parameter -Wno-sign-compare -Wno-deprecated-declarations -Wno-unused-but-set-variable  conftest.c >&5
warning: unknown warning option '-Wno-unused-but-set-variable'; did you mean '-Wno-unused-const-variable'? [-Wunknown-warning-option]
1 warning generated.
configure:17657: $? = 0
configure:17666: result: yes

Reported-by: Torsten Hilbrich <torsten.hilbrich@secunet.com>
2019-04-02 10:48:40 -05:00
Iain Lane
5072db3418 m4/compiler_warnings.m4: Let -Werror be disabled
It's annoying for distributors to build with -Werror, since it means
that compiler upgrades can break the build. Let's let them disable it,
but keep it enabled by default.
2018-04-24 18:08:29 +02:00
Lubomir Rintel
a7942177c9 build: don't disable the aliasing checks
We now don't break the strict aliasing rules.

Also, having a compiler flag that disables a warning among the flags that are
meant to add extra sanity checking is not correct either:
--enable-extra-warnings=no would generate a bad aliasin warning while
the --enable-extra-warnings=yes would not.
2016-07-21 09:49:34 +02:00
Aleksander Morgado
e63e062a76 build: use -Wformat-security 2013-05-17 23:16:01 +02:00
Aleksander Morgado
d74336e96d build: warn about unused but set variables 2012-08-24 11:37:38 +02:00
Aleksander Morgado
917a13217a build: avoid using -Wfloat-equal compilation option
In order to compile code generated by gdbus-codegen.
2012-03-15 14:14:18 +01:00
Aleksander Morgado
bc8010f792 build: avoid using -Wshadow compilation option
In order to compile code generated by gdbus-codegen.
2012-03-15 14:14:18 +01:00
Aleksander Morgado
ff31122eba build: do not warn about using deprecated methods
GValueArray is deprecated since GLib 2.31.14, but we need to use it for
dbus-glib based code.

We should re-enable deprecation warnings once we switch to GDBus.
2012-02-07 19:45:30 +01:00
Michael Biebl
22e687833c build: unify compiler warnings 2010-01-27 15:48:55 -08:00