[petsc-dev] Clang Analyzer
Jed Brown
jed at jedbrown.org
Mon Apr 13 09:45:02 CDT 2015
Lisandro Dalcin <dalcinl at gmail.com> writes:
> On 13 April 2015 at 11:58, Jed Brown <jed at jedbrown.org> wrote:
>> Lisandro Dalcin <dalcinl at gmail.com> 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.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20150413/c729b978/attachment.sig>
More information about the petsc-dev
mailing list