On 1/7/20 3:24 PM, Tim Rühsen wrote:
> Hi,
> 
> with the latest gnulib (a7903da07d3d18c23314aa0815adbb4058fd7cec) on
> Debian Stretch:
> 
> In file included from /usr/include/string.h:630:0,
>                  from ./string.h:41,
>                  from strndup.c:21:
> strndup.c:26:1: error: expected identifier or '(' before '__extension__'
>  strndup (char const *s, size_t n)
>  ^
> 
> config.log is at
> https://gitlab.com/gnuwget/wget2/-/jobs/395706872/artifacts/file/config.log.

The issue is that the ./configure step is run with CFLAGS="-Werror"
(here with CC=clang):

$ grep strndup config.log
configure:8814: checking for strndup
conftest.c:152:6: error: incompatible redeclaration of library function
'strndup' [-Werror,-Wincompatible-library-redeclaration]
char strndup ();
conftest.c:152:6: note: 'strndup' is a builtin with type 'char *(const
char *, unsigned long)'
| /* Define strndup to an innocuous variant, in case <limits.h> declares
strndup.
| #define strndup innocuous_strndup
|     which can conflict with char strndup (); below.
| #undef strndup
| char strndup ();
| #if defined __stub_strndup || defined __stub___strndup
| return strndup ();
configure:20326: checking whether strndup is declared
ac_cv_func_strndup=no
ac_cv_have_decl_strndup=yes


Though it always worked (for my projects), I can imagine that
./configure tests may stumble when -Werror is set. So, is it good
practice not to use -Werror with ./configure ?


Without -Werror:
$ grep strndup config.log
configure:8814: checking for strndup
conftest.c:154:6: warning: conflicting types for built-in function 'strndup'
 char strndup ();
configure:20326: checking whether strndup is declared
configure:38601: checking for working strndup
ac_cv_func_strndup=yes
ac_cv_have_decl_strndup=yes
gl_cv_func_strndup_works=yes


Regards, Tim

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to