mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-07-22 18:54:36 +00:00
build: pass -std=gnu99 to compiler
With --enable-more-warnings, we already used -std=gnu99, see
commit ba2b2de3ad
.
Compilation may behave differently depending on the selected
C standard that we choose. It seems wrong, with more-warnings,
to build against a C standard, while otherwise leaving it undefind.
Indeed, one might argue, that our build system should not use
such compiler specific options. At least, not without detecting
support for the compiler option during ./configure.
However:
- we already did this for --enable-more-warnings.
- we should not program against a theoretical compiler. In practice,
only gcc and clang works to build NetworkManager. Both these compilers
support this option, so there is no reason to not use it. If we ever
come into the situation to support another compiler, adjusting -std=gnu99
will be the smallest problem. Until that happens (and that's far from
imminent), don't pretend to be portable to non-existing compilers and
use the flag that in practice is available.
See-also: https://gcc.gnu.org/onlinedocs/gcc/Standards.html
This commit is contained in:
parent
00a523c4f3
commit
b9bc20f4da
16
Makefile.am
16
Makefile.am
|
@ -105,6 +105,8 @@ endif
|
||||||
|
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
dflt_cppflags = -std=gnu99
|
||||||
|
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
# with autotools, it is not easily possible to generate these defines
|
# with autotools, it is not easily possible to generate these defines
|
||||||
|
@ -592,6 +594,7 @@ nodist_libnminclude_HEADERS += \
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
dflt_cppflags_libnm_core = \
|
dflt_cppflags_libnm_core = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -1216,6 +1219,7 @@ libnm_tests_libnm_vpn_plugin_utils_test_la_SOURCES = \
|
||||||
shared/nm-utils/nm-vpn-plugin-utils.h
|
shared/nm-utils/nm-vpn-plugin-utils.h
|
||||||
|
|
||||||
libnm_tests_libnm_vpn_plugin_utils_test_la_CFLAGS = \
|
libnm_tests_libnm_vpn_plugin_utils_test_la_CFLAGS = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -1322,7 +1326,7 @@ EXTRA_DIST += shared/c-list/src/c-list.h
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
src_libsystemd_nm_la_cppflags = \
|
src_libsystemd_nm_la_cppflags = \
|
||||||
$(dflt_cppflags_std) \
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -1859,6 +1863,7 @@ EXTRA_DIST += \
|
||||||
libexec_PROGRAMS += src/dhcp/nm-dhcp-helper
|
libexec_PROGRAMS += src/dhcp/nm-dhcp-helper
|
||||||
|
|
||||||
src_dhcp_nm_dhcp_helper_CPPFLAGS = \
|
src_dhcp_nm_dhcp_helper_CPPFLAGS = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-DG_LOG_DOMAIN=\""nm-dhcp-helper"\" \
|
-DG_LOG_DOMAIN=\""nm-dhcp-helper"\" \
|
||||||
|
@ -1920,6 +1925,7 @@ core_plugins += src/ppp/libnm-ppp-plugin.la
|
||||||
pppd_plugin_LTLIBRARIES += src/ppp/nm-pppd-plugin.la
|
pppd_plugin_LTLIBRARIES += src/ppp/nm-pppd-plugin.la
|
||||||
|
|
||||||
src_ppp_nm_pppd_plugin_la_CPPFLAGS = \
|
src_ppp_nm_pppd_plugin_la_CPPFLAGS = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -3152,6 +3158,7 @@ noinst_LTLIBRARIES += \
|
||||||
dispatcher/libnm-dispatcher-core.la
|
dispatcher/libnm-dispatcher-core.la
|
||||||
|
|
||||||
dispatcher_cppflags = \
|
dispatcher_cppflags = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -3249,6 +3256,7 @@ EXTRA_DIST += \
|
||||||
check_programs += dispatcher/tests/test-dispatcher-envp
|
check_programs += dispatcher/tests/test-dispatcher-envp
|
||||||
|
|
||||||
dispatcher_tests_test_dispatcher_envp_CPPFLAGS = \
|
dispatcher_tests_test_dispatcher_envp_CPPFLAGS = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -3289,6 +3297,7 @@ EXTRA_DIST += \
|
||||||
bin_PROGRAMS += clients/nm-online
|
bin_PROGRAMS += clients/nm-online
|
||||||
|
|
||||||
clients_nm_online_CPPFLAGS = \
|
clients_nm_online_CPPFLAGS = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -3317,6 +3326,7 @@ EXTRA_DIST += \
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
clients_cppflags = \
|
clients_cppflags = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-core \
|
-I$(srcdir)/libnm-core \
|
||||||
|
@ -3830,6 +3840,7 @@ lib_LTLIBRARIES += libnm-util/libnm-util.la
|
||||||
libnm_util_libnm_util_includedir=$(includedir)/NetworkManager
|
libnm_util_libnm_util_includedir=$(includedir)/NetworkManager
|
||||||
|
|
||||||
libnm_util_cppflags = \
|
libnm_util_cppflags = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/libnm-util \
|
-I$(srcdir)/libnm-util \
|
||||||
-I$(builddir)/libnm-util \
|
-I$(builddir)/libnm-util \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
|
@ -4041,6 +4052,7 @@ dist_dependencies += libnm-util/libnm-util.la
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
libnm_util_tests_cppflags = \
|
libnm_util_tests_cppflags = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-util \
|
-I$(srcdir)/libnm-util \
|
||||||
|
@ -4120,6 +4132,7 @@ EXTRA_DIST += \
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
libnm_glib_cppflags = \
|
libnm_glib_cppflags = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-util \
|
-I$(srcdir)/libnm-util \
|
||||||
|
@ -4398,6 +4411,7 @@ dist_dependencies += \
|
||||||
###############################################################################
|
###############################################################################
|
||||||
|
|
||||||
libnm_glib_tests_cppflags = \
|
libnm_glib_tests_cppflags = \
|
||||||
|
$(dflt_cppflags) \
|
||||||
-I$(srcdir)/shared \
|
-I$(srcdir)/shared \
|
||||||
-I$(builddir)/shared \
|
-I$(builddir)/shared \
|
||||||
-I$(srcdir)/libnm-util \
|
-I$(srcdir)/libnm-util \
|
||||||
|
|
|
@ -58,7 +58,7 @@ if test "$GCC" = "yes" -a "$set_more_warnings" != "no"; then
|
||||||
dnl attach it to the CFLAGS.
|
dnl attach it to the CFLAGS.
|
||||||
NM_COMPILER_WARNING([$1], [unknown-warning-option], [])
|
NM_COMPILER_WARNING([$1], [unknown-warning-option], [])
|
||||||
|
|
||||||
CFLAGS_MORE_WARNINGS="-Wall -std=gnu99"
|
CFLAGS_MORE_WARNINGS="-Wall"
|
||||||
|
|
||||||
if test "x$set_more_warnings" = xerror; then
|
if test "x$set_more_warnings" = xerror; then
|
||||||
CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS -Werror"
|
CFLAGS_MORE_WARNINGS="$CFLAGS_MORE_WARNINGS -Werror"
|
||||||
|
|
Loading…
Reference in a new issue