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

Re: Proposal: Making Debian compiler agnostic

"brian m. carlson" <sandals@crustytoothpaste.net> writes:
> On Tue, Aug 28, 2012 at 10:26:37AM -0700, Russ Allbery wrote:

>> "Fairly OK" is a good way of putting it.  It's not reached the level of
>> "good," but it's probably workable for most practical purposes.  You
>> will get spurious warnings about some things, such as some of the
>> __attribute__ tags, but I don't think I've seen a case where it flatly
>> refuses to compile something or miscompiles it.  That said, I've not
>> used some of the hairier gcc extensions.

> I have some code that uses the __builtin_ia32_* functions for intrinsics
> that clang refuses to compile because it has different, incompatible
> intrinsics (#653256).  Since clang insists on using __GNUC__, it's
> difficult to detect whether the compiler really is GCC or whether it's a
> broken clone (which could be clang or something entirely different).
> clang upstream does not consider this incompatibility a bug; I do.

Yeah, I have similar messes in some of my code.

 * 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"

(Note that Clang does support #pragma GCC diagnostic, so it definitely
does support a bunch of the GCC extensions.)

Russ Allbery (rra@debian.org)               <http://www.eyrie.org/~eagle/>

Reply to: