Lisandro Dalcin <[email protected]> writes:

> On 13 April 2015 at 11:58, Jed Brown <[email protected]> wrote:
>> Lisandro Dalcin <[email protected]> writes:
>>
>>> Jed, hold on. I think this will not work. Does GCC or other compilers
>>> that do support __attribute__((something)) have support for
>>> __has_attribute(something) ?
>>
>> Yes, it has been added to gcc-5 (due out within a week or so).
>
> OK, but then what about previous GCC versions or the Intel compiler? 

Of course not every compiler defines it, so that's why we check:

#ifdef __has_attribute
#  define PETSC_HAS_ATTRIBUTE(a) __has_attribute(a)
#else
#  define PETSC_HAS_ATTRIBUTE(a) 0
#endif

> I mean, we cannot use __has_attribute to remove configure checks.

Actually, I think everything that can be tested that way should be
tested that way.  We've had problems in the past with, for example, the
Intel compiler using a different dialect depending on which gcc is found
in PATH.  These things can change due to a system upgrade or otherwise
and the results are confusing and a pain for the user.  I think it would
be better if petscconf.h was less sensitive to such minor differences.
(Actually, it would be truly wonderful if we could make petscconf.h
private, though that is definitely not feasible in the near term.)

Attachment: signature.asc
Description: PGP signature

Reply via email to