bug-gnulib
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

gnulib intprops.h build error with gcc 7


From: Adrian Bunk
Subject: gnulib intprops.h build error with gcc 7
Date: Thu, 17 Aug 2017 19:28:58 +0300
User-agent: NeoMutt/20170306 (1.8.0)

> Package: src:rush
> Version: 1.8+dfsg-1
>...
> In file included from inttostr.h:25:0,
>                  from anytostr.c:31,
>                  from imaxtostr.c:5:
> intprops.h:236:34: error: expected ')' before '(' token
>     __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
>                                   ^
> Makefile:1284: recipe for target 'imaxtostr.o' failed
>...

This can be reproduced with

$ cat test.c
# define _GL_ADD_OVERFLOW(a, b, min, max)
   __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
$ gcc -c test.c
test.c:2:34: error: expected ‘)’ before ‘(’ token
    __builtin_add_overflow (a, b, (__typeof__ ((a) + (b)) *) 0)
                                  ^
$ 


This is a problem in gnulib, introduced by

commit d22721e2efd88f26588c9710000eb1eeb3ec40de
Author: Paul Eggert <address@hidden>
Date:   Mon Aug 29 10:08:32 2016 -0700

    intprops.h: use __typeof__ with GCC 7
    
    * lib/intprops.h (_GL_ADD_OVERFLOW, _GL_SUBTRACT_OVERFLOW)
    (_GL_MULTIPLY_OVERFLOW): Use __typeof__ as in the GCC manual.
    This avoids computing the expression's value (which might overflow!).


cu
Adrian

-- 

       "Is there not promise of rain?" Ling Tan asked suddenly out
        of the darkness. There had been need of rain for many days.
       "Only a promise," Lao Er said.
                                       Pearl S. Buck - Dragon Seed




reply via email to

[Prev in Thread] Current Thread [Next in Thread]