bug-gnu-utils
[Top][All Lists]
Advanced

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

Re: [BUG FIX] gettext fails to build on platforms with stpncpy defined a


From: Jeremy Huddleston
Subject: Re: [BUG FIX] gettext fails to build on platforms with stpncpy defined as a complex macro
Date: Sun, 15 Aug 2010 10:10:50 -0700

On Aug 15, 2010, at 04:32, Bruno Haible wrote:

> Jeremy Huddleston wrote:
>> On systems where stpncpy is declared as a complex macro, the test will fail.
>> This change address the problem: 
> 
> Thanks for the patch. On which platform (OS and libc version) did you observe
> a problem?

> And what were the consequences? Just a wrong guess, or did the package build
> fail?

An incorrect guess that resulted in a build failure.  As an example, add this 
to your string.h

static inline char *_test_stpncpy(char *restrict s1, const char *restrict s2, 
size_t n) {
    return stpncpy(s1, s2, n);
}
#undef stpncpy
#define stpncpy(dest, src, len)                                  \
  (1 ? _test_stpncpy (dest, src, len) : _test_stpncpy (dest, src, len))

While obviously silly, this is similar enough to show the problem.

The test fails due to a parse error as the test's prototype's "stpncpy" token 
is replaced with the ternary operator.

As a result, configure decides that the system's stpncpy is unusable and needs 
to be replaced.  As a result, codepaths are taken in string.in.h which define a 
replacement stpncpy, but they are using the "stpncpy" token again and thus get 
replaced with the ternary operator from string.h causing a parse failure in the 
build.





reply via email to

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