Patchwork acpica: add -fno-strict-aliasing to ignore type punning warnings (LP: #971886)

login
register
mail settings
Submitter Colin King
Date April 18, 2012, 12:46 p.m.
Message ID <1334753197-23202-1-git-send-email-colin.king@canonical.com>
Download mbox | patch
Permalink /patch/153492/
State Accepted
Headers show

Comments

Colin King - April 18, 2012, 12:46 p.m.
From: Colin Ian King <colin.king@canonical.com>

We don't have much control over the quality of code in the ACPICA core that
is incorporated into fwts.  When compiled on Gentoo there are a bunch of
"dereferencing type-punned pointer will break strict-aliasing rules" warnings
which we can't easily fix.  For now, just use -fno-strict-aliasing on the
ACPICA core to workaround this noise.

Signed-off-by: Colin Ian King <colin.king@canonical.com>
---
 src/acpica/Makefile.am                 |    2 +-
 src/acpica/source/compiler/Makefile.am |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
Keng-Yu Lin - April 19, 2012, 6:46 a.m.
On Wed, Apr 18, 2012 at 8:46 PM, Colin King <colin.king@canonical.com> wrote:
> From: Colin Ian King <colin.king@canonical.com>
>
> We don't have much control over the quality of code in the ACPICA core that
> is incorporated into fwts.  When compiled on Gentoo there are a bunch of
> "dereferencing type-punned pointer will break strict-aliasing rules" warnings
> which we can't easily fix.  For now, just use -fno-strict-aliasing on the
> ACPICA core to workaround this noise.
>
> Signed-off-by: Colin Ian King <colin.king@canonical.com>
> ---
>  src/acpica/Makefile.am                 |    2 +-
>  src/acpica/source/compiler/Makefile.am |    2 +-
>  2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
> index 6a7b4b5..5a475e9 100644
> --- a/src/acpica/Makefile.am
> +++ b/src/acpica/Makefile.am
> @@ -11,7 +11,7 @@ ACPICA_COMP =   $(ACPICA_SRC)/components
>  #
>  # -DACPI_EXEC_APP is specific to making ACPICA for the fwts method test
>  #
> -AM_CPPFLAGS =  -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -I$(top_srcdir)/src/lib/include -I$(ACPICA_SRC)/include -Wall
> +AM_CPPFLAGS =  -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -I$(top_srcdir)/src/lib/include -I$(ACPICA_SRC)/include -Wall -fno-strict-aliasing
>
>  osunixxf_munged.c: $(ACPICA_OSL)/osunixxf.c
>        cat  $(ACPICA_OSL)/osunixxf.c | \
> diff --git a/src/acpica/source/compiler/Makefile.am b/src/acpica/source/compiler/Makefile.am
> index 91db20b..74ae927 100644
> --- a/src/acpica/source/compiler/Makefile.am
> +++ b/src/acpica/source/compiler/Makefile.am
> @@ -2,7 +2,7 @@
>  # We need to build this as a seperate shared library with the iasl functionality built in. We
>  # just export the fwts_* interface.
>  #
> -AM_CPPFLAGS = -Wall -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
> +AM_CPPFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing -D_LINUX -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
>
>  ACPICA_COMPILER     = .
>  ACPICA_COMMON       = ../common
> --
> 1.7.9.5
>

I built fwts with the patch and the warnings are gone.

Acked-by: Keng-Yu Lin <kengyu@canonical.com>
Alex Hung - April 19, 2012, 8:16 a.m.
On 04/18/2012 08:46 PM, Colin King wrote:
> From: Colin Ian King<colin.king@canonical.com>
>
> We don't have much control over the quality of code in the ACPICA core that
> is incorporated into fwts.  When compiled on Gentoo there are a bunch of
> "dereferencing type-punned pointer will break strict-aliasing rules" warnings
> which we can't easily fix.  For now, just use -fno-strict-aliasing on the
> ACPICA core to workaround this noise.
>
> Signed-off-by: Colin Ian King<colin.king@canonical.com>
> ---
>   src/acpica/Makefile.am                 |    2 +-
>   src/acpica/source/compiler/Makefile.am |    2 +-
>   2 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
> index 6a7b4b5..5a475e9 100644
> --- a/src/acpica/Makefile.am
> +++ b/src/acpica/Makefile.am
> @@ -11,7 +11,7 @@ ACPICA_COMP =   $(ACPICA_SRC)/components
>   #
>   # -DACPI_EXEC_APP is specific to making ACPICA for the fwts method test
>   #
> -AM_CPPFLAGS =  -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -I$(top_srcdir)/src/lib/include -I$(ACPICA_SRC)/include -Wall
> +AM_CPPFLAGS =  -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -I$(top_srcdir)/src/lib/include -I$(ACPICA_SRC)/include -Wall -fno-strict-aliasing
>
>   osunixxf_munged.c: $(ACPICA_OSL)/osunixxf.c
>   	cat  $(ACPICA_OSL)/osunixxf.c | \
> diff --git a/src/acpica/source/compiler/Makefile.am b/src/acpica/source/compiler/Makefile.am
> index 91db20b..74ae927 100644
> --- a/src/acpica/source/compiler/Makefile.am
> +++ b/src/acpica/source/compiler/Makefile.am
> @@ -2,7 +2,7 @@
>   # We need to build this as a seperate shared library with the iasl functionality built in. We
>   # just export the fwts_* interface.
>   #
> -AM_CPPFLAGS = -Wall -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
> +AM_CPPFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing -D_LINUX -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
>
>   ACPICA_COMPILER     = .
>   ACPICA_COMMON       = ../common

Acked-by: Alex Hung <alex.hung@canonical.com>

Patch

diff --git a/src/acpica/Makefile.am b/src/acpica/Makefile.am
index 6a7b4b5..5a475e9 100644
--- a/src/acpica/Makefile.am
+++ b/src/acpica/Makefile.am
@@ -11,7 +11,7 @@  ACPICA_COMP =   $(ACPICA_SRC)/components
 #
 # -DACPI_EXEC_APP is specific to making ACPICA for the fwts method test
 #
-AM_CPPFLAGS =  -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -I$(top_srcdir)/src/lib/include -I$(ACPICA_SRC)/include -Wall
+AM_CPPFLAGS =  -D_LINUX -DNDEBUG -D_CONSOLE -DACPI_EXEC_APP -I$(top_srcdir)/src/lib/include -I$(ACPICA_SRC)/include -Wall -fno-strict-aliasing
 
 osunixxf_munged.c: $(ACPICA_OSL)/osunixxf.c
 	cat  $(ACPICA_OSL)/osunixxf.c | \
diff --git a/src/acpica/source/compiler/Makefile.am b/src/acpica/source/compiler/Makefile.am
index 91db20b..74ae927 100644
--- a/src/acpica/source/compiler/Makefile.am
+++ b/src/acpica/source/compiler/Makefile.am
@@ -2,7 +2,7 @@ 
 # We need to build this as a seperate shared library with the iasl functionality built in. We
 # just export the fwts_* interface.
 #
-AM_CPPFLAGS = -Wall -Wstrict-prototypes -D_LINUX -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
+AM_CPPFLAGS = -Wall -Wstrict-prototypes -fno-strict-aliasing -D_LINUX -DACPI_ASL_COMPILER $(CFLAGS) -I$(top_srcdir)/src/acpica/source/include
 
 ACPICA_COMPILER     = .
 ACPICA_COMMON       = ../common