On Tue, May 29, 2012 at 10:57:28AM +0200, Dodji Seketeli wrote:
> 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;

Ok.

        Jakub

Reply via email to