diff --git a/Makefile.am b/Makefile.am index b73007d4..f78b2f10 100644 --- a/Makefile.am +++ b/Makefile.am @@ -39,7 +39,9 @@ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' \ -DRPM_OSTREE_FEATURES='"$(RPM_OSTREE_FEATURES)"' \ -DRPM_OSTREE_GITREV='"$(RPM_OSTREE_GITREV)"' \ -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_50 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_50 -AM_CFLAGS += -std=gnu11 $(WARN_CFLAGS) +# Keep this in sync with the AM_CFLAGS in libostree; see +# that project for more information about e.g. -fno-strict-aliasing +AM_CFLAGS += -std=gnu11 -fno-strict-aliasing $(WARN_CFLAGS) # bundled libdnf AM_LDFLAGS += "-Wl,-rpath=$(libdir)/rpm-ostree" diff --git a/configure.ac b/configure.ac index 0a3f2bf2..7b934826 100644 --- a/configure.ac +++ b/configure.ac @@ -38,24 +38,29 @@ AC_SUBST([dbusservicedir], [$dbusservicedir]) AC_MSG_RESULT(dbusservicedir) dnl Keep this in sync with the version in ostree +AS_IF([echo "$CFLAGS" | grep -q -E -e '-Werror($| )'], [], [ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\ - -pipe \ - -Wall \ - -Werror=empty-body \ - -Werror=strict-prototypes \ - -Werror=missing-prototypes \ - -Werror=implicit-function-declaration \ - "-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \ - -Werror=pointer-arith -Werror=init-self \ - -Werror=missing-declarations \ - -Werror=return-type \ - -Werror=overflow \ - -Werror=int-conversion \ - -Werror=parenthesis \ - -Werror=incompatible-pointer-types \ - -Werror=misleading-indentation \ - -Werror=missing-include-dirs -Werror=aggregate-return \ -]) + -pipe \ + -Wall \ + -Werror=empty-body \ + -Werror=strict-prototypes \ + -Werror=missing-prototypes \ + -Werror=implicit-function-declaration \ + "-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \ + -Werror=pointer-arith -Werror=init-self \ + -Werror=missing-declarations \ + -Werror=return-type \ + -Werror=switch \ + -Werror=overflow \ + -Werror=int-conversion \ + -Werror=parenthesis \ + -Werror=undef \ + -Werror=incompatible-pointer-types \ + -Werror=misleading-indentation \ + -Werror=missing-include-dirs -Werror=aggregate-return \ + -Wstrict-aliasing=2 \ + -Werror=unused-result \ +])]) AC_SUBST(WARN_CFLAGS) AC_MSG_CHECKING([for -fsanitize=address in CFLAGS])