From da6cae426a5baf24aeab9c7f9710c55c72a0b1b2 Mon Sep 17 00:00:00 2001 From: zimoch Date: Tue, 26 Nov 2013 08:52:30 +0000 Subject: [PATCH] compiler option -fno-strict-aliasing added (allows cast from function pointer to data pointer) --- configure/CONFIG.gnuCommon | 4 ++++ configure/os/CONFIG.Common.vxWorksCommon | 8 ++++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/configure/CONFIG.gnuCommon b/configure/CONFIG.gnuCommon index f0548024e..63d07d11b 100644 --- a/configure/CONFIG.gnuCommon +++ b/configure/CONFIG.gnuCommon @@ -55,3 +55,7 @@ GNU_LDLIBS_YES = -lgcc # Use GNU compiler flags to generate header dependancies files HDEPENDS_METHOD = CFLAGS + +# Disable strict alias optimizations (and warnings) +CODE_CFLAGS += -fno-strict-aliasing +CODE_CXXFLAGS += -fno-strict-aliasing diff --git a/configure/os/CONFIG.Common.vxWorksCommon b/configure/os/CONFIG.Common.vxWorksCommon index 95084889a..da4f76731 100644 --- a/configure/os/CONFIG.Common.vxWorksCommon +++ b/configure/os/CONFIG.Common.vxWorksCommon @@ -176,7 +176,11 @@ OPT_CXXFLAGS_YES = -O2 #-------------------------------------------------- # code flags -CODE_CFLAGS = +# From gcc 3 on, casting from function ptr to data ptr generates warning +CODE_CFLAGS_3 = -fno-strict-aliasing +CODE_CFLAGS_4 = -fno-strict-aliasing +CODE_CFLAGS = $(CODE_CFLAGS_$(VX_GNU_MAJOR_VERSION)) + # # For vxWorks versions before 6.3 we need this g++ compiler flag CODE_CXXFLAGS_5 = -fno-implicit-templates @@ -184,7 +188,7 @@ CODE_CXXFLAGS_6.0 = -fno-implicit-templates CODE_CXXFLAGS_6.1 = -fno-implicit-templates CODE_CXXFLAGS_6.2 = -fno-implicit-templates CODE_CXXFLAGS_6 = $(CODE_CXXFLAGS_$(VXWORKS_VERSION)) -CODE_CXXFLAGS = $(CODE_CXXFLAGS_$(VXWORKS_MAJOR_VERSION)) +CODE_CXXFLAGS = $(CODE_CXXFLAGS_$(VXWORKS_MAJOR_VERSION)) $(CODE_CFLAGS_$(VX_GNU_MAJOR_VERSION)) #-------------------------------------------------- # no shared libs for vxWorks