On Wed, May 28, 2014 at 11:38:55AM +0200, Richard Biener wrote:
> On Wed, May 28, 2014 at 10:24 AM, FX <[email protected]> wrote:
> >> Yeah, a portable (C and C++) static assert would be nice. And also pushing
> >> this to gmp then.
> >>
> >> In the meantime I see nothing wrong in "merging" from GMP.
> >
> > One question, one comment:
> >
> > 1. can I count your “I see nothing wrong” as an approval, as in “global
> > reviewers can approve changes to any part of the compiler or associated
> > libraries”?
>
> Well, kind of. But Jakub is as well, so I don't want to override him. So
> please wait for an ack from Jakub. I agree with him that the casts
> served a purpose and that, if removed, they need to be replaced with
> an appropriate assertion measure.
I think my preference would be to change include/ansidecl.h to:
/* This macro simplifies testing whether we are using gcc, and if it
is of a particular minimum version. (Both major & minor numbers are
significant.) This macro will evaluate to 0 if we are not using
gcc at all.*/
#ifndef GCC_VERSION
+/* Some compilers pretend to be GCC, even when they are not. */
+#if defined(__clang__) || defined(__INTEL_COMPILER)
+#define GCC_VERSION 0
+#else
#define GCC_VERSION (__GNUC__ * 1000 + __GNUC_MINOR__)
+#endif
#endif /* GCC_VERSION */
so that we really can trust the GCC_VERSION macro, casts in lhs of inline
asm isn't the only incompatibility clang has.
Any other compilers that define __GNUC__?
Jakub