Hi Bruce,
>> On 06/26/14 02:18, Rainer Orth wrote:
>>> Ok for mainline?
>>
>> Could you please reformat the c_fix_arg's and test-text to be "here strings"
>> a la:
>>
>> c_fix_arg = <<- _EOS_
>> #undef signbit
>> #define signbit(x) (sizeof(x) == sizeof(float) \
>> \ ? __builtin_signbitf(x) \
>> \ : sizeof(x) == sizeof(long double) \
>> \ ? __builtin_signbitl(x) \
>> \ : __builtin_signbit(x))";
>> _EOS_;
>>
>> I changed the "here string" thingy to eat that tab-backslash
>> and leave the rest of the tabs a few years ago.
>
> It's not yet in autogen 5.9: I've diffed the fixincl.x generated with my
> original patch and the amended one and those backslashes after the
> leading tab are still there.
I've now managed to build autogen 5.18.3 on Solaris 11, but still there
is some trouble: with the following fix
/*
* Newer Solaris 10/11 GCC signbit implementations cause strict-aliasing
* warnings.
*/
fix = {
hackname = solaris_math_11;
select = '@\(#\)math_c99\.h' "[ \t]+1\\.[0-9]+[ \t]+[0-9/]+ ";
files = iso/math_c99.h;
c_fix = format;
c_fix_arg = <<- _EOFix_
#undef signbit
#define signbit(x) (sizeof(x) == sizeof(float) \
\ ? __builtin_signbitf(x) \
\ : sizeof(x) == sizeof(long double) \
\ ? __builtin_signbitl(x) \
\ : __builtin_signbit(x))
_EOFix_;
c_fix_arg = <<- _EOArg_
^#undef[ ]+signbit
#if defined\(__sparc\)
#define[ ]+signbit\(x\)[ ]+__extension__\( \\
[ ]+\{[ ]*__typeof\(x\)[ ]*__x_s[ ]*=[
]*\(x\);[ ]*\\
[ ]+\(int\)[ ]*\(\*\(unsigned[ ]*\*\)[
]*\&__x_s[ ]*>>[ ]*31\);[ ]*\}\)
#elif defined\(__i386\) \|\| defined\(__amd64\)
#define[ ]+signbit\(x\)[ ]+__extension__\( \\
[ ]+\{ __typeof\(x\) __x_s = \(x\); \\
[ ]+\(sizeof \(__x_s\) == sizeof \(float\) \? \\
[ ]+\(int\) \(\*\(unsigned \*\) \&__x_s >> 31\) : \\
[ ]+sizeof \(__x_s\) == sizeof \(double\) \? \\
[ ]+\(int\) \(\(\(unsigned \*\) \&__x_s\)\[1\] >> 31\) : \\
[ ]+\(int\) \(\(\(unsigned short \*\) \&__x_s\)\[4\] >> 15\)\);
\}\)
#endif
_EOArg_;
test_text = <<- _EOText_
/* @(#)math_c99.h 1.14 13/03/27 */
#undef signbit
#if defined(__sparc)
#define signbit(x) __extension__( \\
\ { __typeof(x) __x_s = (x); \\
\ (int) (*(unsigned *) &__x_s >> 31); })
#elif defined(__i386) || defined(__amd64)
#define signbit(x) __extension__( \\
\ { __typeof(x) __x_s = (x); \\
\ (sizeof (__x_s) == sizeof (float) ? \\
\ (int) (*(unsigned *) &__x_s >> 31) : \\
\ sizeof (__x_s) == sizeof (double) ? \\
\ (int) (((unsigned *) &__x_s)[1] >> 31) : \\
\ (int) (((unsigned short *) &__x_s)[4] >> 15));
})
#endif
_EOText_;
};
the test passes (not ran a bootstrap yet). But I had to make two
unexpected changes:
* In the second c_fix_arg, all \t in charsets had to be replaced by
literal TABs, otherwise they would occur as \\t in fixincl.x.
* In test_text, I had to backslash-escape the trailing \, otherwise they
were eaten up. Whether or not I do this makes no difference for the
generated fixincl.x, but only with the escaping does make check pass.
>> That is considerably more readable than:
>>
>> c_fix_arg = "#undef\tsignbit\n"
>> "#define\tsignbit(x)\t(sizeof(x) == sizeof(float) \\\n"
>> "\t\t\t ? __builtin_signbitf(x) \\\n"
>> "\t\t\t : sizeof(x) == sizeof(long double) \\\n"
>> "\t\t\t ? __builtin_signbitl(x) \\\n"
>> "\t\t\t : __builtin_signbit(x))";
>>
>> and the other two are worse. Thank you!
>
> Fully agreed, that's why I tried that route first.
>
> I'm currently fighting to build autogen 5.18.3 and all its dependencies.
> Trouble is, if we do require a version newer than 5.5.4 as documented in
> install.texi, fixincludes make check will suddenly start to fail for
> those whose autogen version isn't recent enough.
This is certainly something that needs to be decided: if we go this
route, we should bump the autogen version requirement in install.texi
(to whatever is necessary to support the TAB\ magic).
Thanks.
Rainer
--
-----------------------------------------------------------------------------
Rainer Orth, Center for Biotechnology, Bielefeld University