[PATCH v2] Address regressions from e8ff555b95baab66cc7d060c1e7f9fdd49d3802f

Alan Coopersmith alan.coopersmith at oracle.com
Thu Sep 22 20:01:23 PDT 2011


On 09/22/11 07:49 PM, Alan Coopersmith wrote:
> On 09/22/11 07:11 PM, Jeremy Huddleston wrote:
>> -static inline void __builtin_constant_p(int x)
>> +static inline int constant_p(int x)
>> {
>> +#if defined(__GNUC__) || (defined(__SUNPRO_C)&& (__SUNPRO_C>= 0x590))
>> + return __builtin_constant_p(x);
>> +#else
>> return 0;
>> -}
>> #endif
>> +}
>
> Since __builtin_constant_p is more of a keyword than a function, does the
> magic still work when you have the extra level of indirection?

A quick test with gcc 4.5 & Studio 12.1 seemed to confirm that it doesn't
work that way:

alanc at also:/tmp [7:35pm - 1] cc -o constest-cc constest.c
alanc at also:/tmp [7:59pm - 2] gcc -o constest-gcc constest.c
alanc at also:/tmp [7:59pm - 3] ./constest-gcc
Failed: 1 not recognized as a constant
Control group Passed: 1 is a constant
Passed: argc is not a constant
Control group Passed: argc is not a constant
alanc at also:/tmp [7:59pm - 4] ./constest-cc
Failed: 1 not recognized as a constant
Control group Passed: 1 is a constant
Passed: argc is not a constant
Control group Passed: argc is not a constant

with the source file from the attachment.


-- 
	-Alan Coopersmith-        alan.coopersmith at oracle.com
	 Oracle Solaris Platform Engineering: X Window System

-------------- next part --------------
A non-text attachment was scrubbed...
Name: constest.c
Type: text/x-csrc
Size: 886 bytes
Desc: not available
URL: <http://lists.x.org/archives/xorg-devel/attachments/20110922/6f1015ac/attachment.c>


More information about the xorg-devel mailing list