[llvm] r201679 - Disable override and final C++ keyword in gcc 4.6.

Logan Chien tzuhsiang.chien at gmail.com
Wed Feb 19 09:11:11 PST 2014


Hi Aaron,

I know that GCC 4.7 is the minimum support compiler.  However, since the
change is limited to the compiler compatibility header (there are even some
checks for GCC 3.1 in this header) and this change fixes the build and
passes all test cases, I feel it is acceptable in this case.

Although I know the code base might be incompatible with GCC 4.6 in the
near future, I wish to keep the backward compatibility as long as possible
given that only some simple change to compiler compatibility header is
required.  I agree that it won't make sense to stick with old syntax or
prohibit the usage of new language feature just for the backward
compatibility of the unsupported GCC 4.6.

Sincerely,
Logan


On Wed, Feb 19, 2014 at 11:27 PM, Aaron Ballman <aaron at aaronballman.com>wrote:

> Since our min supported compiler version is 4.7 (as of llvm 3.4), I
> don't believe this commit really makes sense. Since we're trying to
> make the switch to using C++11 functionality, I don't think we want to
> add support for older compilers which will fail in other ways.
>
> ~Aaron
>
> On Wed, Feb 19, 2014 at 10:04 AM, Logan Chien <tzuhsiang.chien at gmail.com>
> wrote:
> > Author: logan
> > Date: Wed Feb 19 09:04:29 2014
> > New Revision: 201679
> >
> > URL: http://llvm.org/viewvc/llvm-project?rev=201679&view=rev
> > Log:
> > Disable override and final C++ keyword in gcc 4.6.
> >
> > According to http://gcc.gnu.org/projects/cxx0x.html,
> > override and final keyword was added in gcc 4.7.  Thus,
> > we should not use these keywords in gcc 4.6 even when
> > __GXX_EXPERIMENTAL_CXX0X__ is available.
> >
> > Modified:
> >     llvm/trunk/include/llvm/Support/Compiler.h
> >
> > Modified: llvm/trunk/include/llvm/Support/Compiler.h
> > URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/Compiler.h?rev=201679&r1=201678&r2=201679&view=diff
> >
> ==============================================================================
> > --- llvm/trunk/include/llvm/Support/Compiler.h (original)
> > +++ llvm/trunk/include/llvm/Support/Compiler.h Wed Feb 19 09:04:29 2014
> > @@ -152,7 +152,8 @@
> >  /// LLVM_FINAL - Expands to 'final' if the compiler supports it.
> >  /// Use to mark classes or virtual methods as final.
> >  #if __has_feature(cxx_override_control) || \
> > -    defined(__GXX_EXPERIMENTAL_CXX0X__) || LLVM_MSC_PREREQ(1700)
> > +    (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC_PREREQ(4, 7)) || \
> > +    LLVM_MSC_PREREQ(1700)
> >  #define LLVM_FINAL final
> >  #else
> >  #define LLVM_FINAL
> > @@ -161,7 +162,8 @@
> >  /// LLVM_OVERRIDE - Expands to 'override' if the compiler supports it.
> >  /// Use to mark virtual methods as overriding a base class method.
> >  #if __has_feature(cxx_override_control) || \
> > -    defined(__GXX_EXPERIMENTAL_CXX0X__) || LLVM_MSC_PREREQ(1700)
> > +    (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC_PREREQ(4, 7)) || \
> > +    LLVM_MSC_PREREQ(1700)
> >  #define LLVM_OVERRIDE override
> >  #else
> >  #define LLVM_OVERRIDE
> >
> >
> > _______________________________________________
> > llvm-commits mailing list
> > llvm-commits at cs.uiuc.edu
> > http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140220/e995d438/attachment.html>


More information about the llvm-commits mailing list