From: Michael Jeanson Date: Tue, 6 Apr 2021 22:18:02 +0000 (-0400) Subject: Disable strict-aliasing globally X-Git-Tag: v2.13.0-rc1~84 X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=08c0c18ad4d5acf6e6f84c39935f359e6706ea8b;p=lttng-ust.git Disable strict-aliasing globally Change-Id: Idaf3407c827eeff05f5e52afb446484ff959dbd0 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- diff --git a/configure.ac b/configure.ac index cf2e0e3e..66e07f7f 100644 --- a/configure.ac +++ b/configure.ac @@ -179,6 +179,11 @@ AC_LANG_POP([C]) # Clang >= 3.3 (required by the project) and are only valid for C code. WARN_CFLAGS="${WARN_CFLAGS} -Wold-style-definition -Wstrict-prototypes" +# Disable 'strict aliasing' if the compiler supports it. +AC_LANG_PUSH([C]) +AX_APPEND_COMPILE_FLAGS([-fno-strict-aliasing], [OPT_CFLAGS], [-Werror]) +AC_LANG_POP([C]) + ## ## ## C++ compiler checks ## @@ -544,7 +549,7 @@ AC_SUBST([LTTNG_UST_CTL_LIBRARY_VERSION], ust_ctl_lib_version) # Major soname for python-lttngust AC_SUBST([LTTNG_UST_LIB_SONAME_MAJOR], [ust_lib_version_current]) -AM_CFLAGS="$WARN_CFLAGS $URCU_CFLAGS $PTHREAD_CFLAGS" +AM_CFLAGS="$OPT_CFLAGS $WARN_CFLAGS $URCU_CFLAGS $PTHREAD_CFLAGS" AC_SUBST(AM_CFLAGS) AM_CXXFLAGS="$WARN_CXXFLAGS $URCU_CFLAGS $PTHREAD_CFLAGS" diff --git a/src/lib/lttng-ust-ctl/Makefile.am b/src/lib/lttng-ust-ctl/Makefile.am index f8cc70cb..807d8fa6 100644 --- a/src/lib/lttng-ust-ctl/Makefile.am +++ b/src/lib/lttng-ust-ctl/Makefile.am @@ -1,7 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-only AM_CPPFLAGS += -I$(top_srcdir)/liblttng-ust-comm -AM_CFLAGS += -fno-strict-aliasing lib_LTLIBRARIES = liblttng-ust-ctl.la diff --git a/src/lib/lttng-ust-cyg-profile/Makefile.am b/src/lib/lttng-ust-cyg-profile/Makefile.am index 26b50156..234c11bc 100644 --- a/src/lib/lttng-ust-cyg-profile/Makefile.am +++ b/src/lib/lttng-ust-cyg-profile/Makefile.am @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing +AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust-cyg-profile.la \ liblttng-ust-cyg-profile-fast.la diff --git a/src/lib/lttng-ust-dl/Makefile.am b/src/lib/lttng-ust-dl/Makefile.am index f1b87ea8..b5a2d366 100644 --- a/src/lib/lttng-ust-dl/Makefile.am +++ b/src/lib/lttng-ust-dl/Makefile.am @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing +AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust-dl.la liblttng_ust_dl_la_SOURCES = \ diff --git a/src/lib/lttng-ust-fd/Makefile.am b/src/lib/lttng-ust-fd/Makefile.am index 23c4d136..f0c4f01e 100644 --- a/src/lib/lttng-ust-fd/Makefile.am +++ b/src/lib/lttng-ust-fd/Makefile.am @@ -1,7 +1,5 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -fno-strict-aliasing - lib_LTLIBRARIES = liblttng-ust-fd.la liblttng_ust_fd_la_SOURCES = \ lttng-ust-fd.c diff --git a/src/lib/lttng-ust-fork/Makefile.am b/src/lib/lttng-ust-fork/Makefile.am index de3d2d60..648a99e6 100644 --- a/src/lib/lttng-ust-fork/Makefile.am +++ b/src/lib/lttng-ust-fork/Makefile.am @@ -1,7 +1,5 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -fno-strict-aliasing - lib_LTLIBRARIES = liblttng-ust-fork.la liblttng_ust_fork_la_SOURCES = ustfork.c liblttng_ust_fork_la_LIBADD = \ diff --git a/src/lib/lttng-ust-libc-wrapper/Makefile.am b/src/lib/lttng-ust-libc-wrapper/Makefile.am index 0507e4df..4490bb60 100644 --- a/src/lib/lttng-ust-libc-wrapper/Makefile.am +++ b/src/lib/lttng-ust-libc-wrapper/Makefile.am @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing +AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust-libc-wrapper.la diff --git a/src/lib/lttng-ust-pthread-wrapper/Makefile.am b/src/lib/lttng-ust-pthread-wrapper/Makefile.am index 3edb72a7..5eb1a03d 100644 --- a/src/lib/lttng-ust-pthread-wrapper/Makefile.am +++ b/src/lib/lttng-ust-pthread-wrapper/Makefile.am @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing +AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust-pthread-wrapper.la diff --git a/src/lib/lttng-ust-python-agent/Makefile.am b/src/lib/lttng-ust-python-agent/Makefile.am index 619a268f..2c65d6b5 100644 --- a/src/lib/lttng-ust-python-agent/Makefile.am +++ b/src/lib/lttng-ust-python-agent/Makefile.am @@ -1,7 +1,7 @@ # SPDX-License-Identifier: LGPL-2.1-only # tracepoint provider: always built/installed (does not depend on Python per se) -AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing +AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust-python-agent.la diff --git a/src/lib/lttng-ust/Makefile.am b/src/lib/lttng-ust/Makefile.am index a935bdbe..4aa576be 100644 --- a/src/lib/lttng-ust/Makefile.am +++ b/src/lib/lttng-ust/Makefile.am @@ -1,6 +1,6 @@ # SPDX-License-Identifier: LGPL-2.1-only -AM_CFLAGS += -I$(srcdir) -fno-strict-aliasing +AM_CFLAGS += -I$(srcdir) lib_LTLIBRARIES = liblttng-ust.la