build-sys: Sync CFLAGS with libostree

In particular this pulls in `-fno-strict-aliasing`.  See
https://github.com/ostreedev/ostree/pull/1384

Closes: #1156
Approved by: jlebon
This commit is contained in:
Colin Walters 2017-12-15 09:52:48 -05:00 committed by Atomic Bot
parent 8d176e1f92
commit 937ad1b1fc
2 changed files with 25 additions and 18 deletions

View File

@ -39,7 +39,9 @@ AM_CPPFLAGS += -DDATADIR='"$(datadir)"' \
-DRPM_OSTREE_FEATURES='"$(RPM_OSTREE_FEATURES)"' \ -DRPM_OSTREE_FEATURES='"$(RPM_OSTREE_FEATURES)"' \
-DRPM_OSTREE_GITREV='"$(RPM_OSTREE_GITREV)"' \ -DRPM_OSTREE_GITREV='"$(RPM_OSTREE_GITREV)"' \
-DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_50 -DGLIB_VERSION_MAX_ALLOWED=GLIB_VERSION_2_50 -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 # bundled libdnf
AM_LDFLAGS += "-Wl,-rpath=$(libdir)/rpm-ostree" AM_LDFLAGS += "-Wl,-rpath=$(libdir)/rpm-ostree"

View File

@ -38,24 +38,29 @@ AC_SUBST([dbusservicedir], [$dbusservicedir])
AC_MSG_RESULT(dbusservicedir) AC_MSG_RESULT(dbusservicedir)
dnl Keep this in sync with the version in ostree 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], [\ CC_CHECK_FLAGS_APPEND([WARN_CFLAGS], [CFLAGS], [\
-pipe \ -pipe \
-Wall \ -Wall \
-Werror=empty-body \ -Werror=empty-body \
-Werror=strict-prototypes \ -Werror=strict-prototypes \
-Werror=missing-prototypes \ -Werror=missing-prototypes \
-Werror=implicit-function-declaration \ -Werror=implicit-function-declaration \
"-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \ "-Werror=format=2 -Werror=format-security -Werror=format-nonliteral" \
-Werror=pointer-arith -Werror=init-self \ -Werror=pointer-arith -Werror=init-self \
-Werror=missing-declarations \ -Werror=missing-declarations \
-Werror=return-type \ -Werror=return-type \
-Werror=overflow \ -Werror=switch \
-Werror=int-conversion \ -Werror=overflow \
-Werror=parenthesis \ -Werror=int-conversion \
-Werror=incompatible-pointer-types \ -Werror=parenthesis \
-Werror=misleading-indentation \ -Werror=undef \
-Werror=missing-include-dirs -Werror=aggregate-return \ -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_SUBST(WARN_CFLAGS)
AC_MSG_CHECKING([for -fsanitize=address in CFLAGS]) AC_MSG_CHECKING([for -fsanitize=address in CFLAGS])