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

Re: Proposal: Making Debian compiler agnostic

Le 29/08/2012 06:33, Russ Allbery a écrit :
> /*
>  * LLVM and Clang pretend to be GCC but don't support all of the __attribute__
>  * settings that GCC does.  For them, suppress warnings about unknown
>  * attributes on declarations.  This unfortunately will affect the entire
>  * compilation context, but there's no push and pop available.
>  */
> #if !defined(__attribute__) && (defined(__llvm__) || defined(__clang__))
> # pragma GCC diagnostic ignored "-Wattributes"
> #endif

There exists some kind of push/pop but I'm not sure it is relevant is
your context nor that llvm/clang support them.
  In one of my projects where I include a header file that produces
warnings (with #warning ...) and that adds the "deprecated" attribute
to some function, I use:

#pragma GCC diagnostic push
#  pragma GCC diagnostic ignored "-Wcpp"
#  include <CL/cl.h>
#pragma GCC diagnostic pop

#pragma GCC diagnostic ignored "-Wdeprecated-declarations"

Note that the "-Wdeprecated-declarations" is not in the push/pop
section because it needs to be active at the time that deprecated
functions are used, not at the time that deprecated functions are
declared with their attribute (ie in <CL/cl.h>)


Vincent Danjean       GPG key ID 0x9D025E87         vdanjean@debian.org
GPG key fingerprint: FC95 08A6 854D DB48 4B9A  8A94 0BF7 7867 9D02 5E87
Unofficial pkgs: http://moais.imag.fr/membres/vincent.danjean/deb.html
APT repo:  deb http://people.debian.org/~vdanjean/debian unstable main

Reply to: