[PATCH] PR bootstrap/53459 - unused local typedef when building on altivec

Dodji Seketeli dodji@redhat.com
Fri May 25 08:12:00 GMT 2012


Tom Tromey <tromey@redhat.com> writes:

>>>>>> "Dodji" == Dodji Seketeli <dodji@redhat.com> writes:
>
> I didn't see a gcc-patches CC...?

Woops, indeed.  Sorry.  I have just bounced the original messages to the
list now.

>
> Dodji> When building the compiler on altivec, it appears that an unused local
> Dodji> typedef is lurking in a function of libcpp, breaking bootstrap since now
> Dodji> -Wunused-local-typedefs is activated by -Wall.
>
> Dodji> -    typedef char check_count[(N == 2 || N == 4) * 2 - 1];
>
> I think this is a static assert.
> You should probably try s/typedef/extern/ instead.

And you are right.  I was probably too hasty on this one.  Here are two
patchlets for trunk then.  The first one to revert my wrong commit, and
the second one to fix the issue as you suggest.  My tree bootstrap with
these.

Dominique, maybe you could test it on your side?

Thanks, and sorry for the inconvenience.

>From d65626ffe5ea39eddb0ed2bb9c73f3ab3073fc09 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@redhat.com>
Date: Fri, 25 May 2012 09:29:33 +0200
Subject: [PATCH 1/2] Revert "PR bootstrap/53459 - unused local typedef when
 building on altivec"

This reverts commit r187853
---
 libcpp/ChangeLog |    5 -----
 libcpp/lex.c     |    1 +
 2 files changed, 1 insertions(+), 5 deletions(-)


diff --git a/libcpp/lex.c b/libcpp/lex.c
index 2ebbee9..c4dd603 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -590,6 +590,7 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
   {
 #define N  (sizeof(vc) / sizeof(long))
 
+    typedef char check_count[(N == 2 || N == 4) * 2 - 1];
     union {
       vc v;
       unsigned long l[N];
-- 
1.7.6.5


>From 690564ffc05a9b8ed8629860878133b0864e3ea4 Mon Sep 17 00:00:00 2001
From: Dodji Seketeli <dodji@redhat.com>
Date: Fri, 25 May 2012 09:36:17 +0200
Subject: [PATCH 2/2] PR bootstrap/53459 - unused local typedef when building
 on altivec

	PR bootstrap/53459
	* lex.c (search_line_fast): Avoid unused local typedefs to simulate
	a static assertion.
---
 libcpp/ChangeLog |    6 ++++++
 libcpp/lex.c     |    4 ++--
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/libcpp/lex.c b/libcpp/lex.c
index c4dd603..d82e335 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -589,8 +589,8 @@ search_line_fast (const uchar *s, const uchar *end ATTRIBUTE_UNUSED)
 
   {
 #define N  (sizeof(vc) / sizeof(long))
-
-    typedef char check_count[(N == 2 || N == 4) * 2 - 1];
+    /* The below is a static assertion.  */
+    extern char check_count[(N == 2 || N == 4) * 2 - 1];
     union {
       vc v;
       unsigned long l[N];
-- 
1.7.6.5


-- 
		Dodji



More information about the Gcc-patches mailing list