domi...@lps.ens.fr (Dominique Dhumieres) writes:

> I have regstapped r187893 with the following patch
>
> [karma] gcc/darwin_buildw% diff -up ../_gcc_clean/libcpp/lex.c 
> ../work/libcpp/lex.c
> --- ../_gcc_clean/libcpp/lex.c        2012-05-25 08:54:05.000000000 +0200
> +++ ../work/libcpp/lex.c      2012-05-27 13:25:08.000000000 +0200
> @@ -592,7 +592,8 @@ search_line_fast (const uchar *s, const 
>  
>      union {
>        vc v;
> -      unsigned long l[N];
> +      /* Statically assert that N is 2 or 4.  */
> +      unsigned long l[(N == 2 || N == 4) ? N : -1];
>      } u;
>      unsigned long l, i = 0;
>  
>
> without related regression.

Thank you, Dominique.

So, dear maintainers, is the patch below OK?  It bootstraps on
x86_64-unknown-linux-gnu as well.

        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..98ee4e9 100644
--- a/libcpp/lex.c
+++ b/libcpp/lex.c
@@ -590,10 +590,10 @@ 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];
+      /* Statically assert that N is 2 or 4.  */
+      unsigned long l[(N == 2 || N == 4) ? N : -1];
     } u;
     unsigned long l, i = 0;
 
-- 
                Dodji

Reply via email to