r352672 - Don't define __has_feature(objc_fixed_enum) in non-objc mode

Erik Pilkington via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 30 13:14:08 PST 2019


Author: epilk
Date: Wed Jan 30 13:14:08 2019
New Revision: 352672

URL: http://llvm.org/viewvc/llvm-project?rev=352672&view=rev
Log:
Don't define __has_feature(objc_fixed_enum) in non-objc mode

This is only a formal language feature in ObjC, otherwise its just an
extension. Making this change was also an ABI break.

Modified:
    cfe/trunk/include/clang/Basic/Features.def
    cfe/trunk/test/SemaObjC/enum-fixed-type.m

Modified: cfe/trunk/include/clang/Basic/Features.def
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/Features.def?rev=352672&r1=352671&r2=352672&view=diff
==============================================================================
--- cfe/trunk/include/clang/Basic/Features.def (original)
+++ cfe/trunk/include/clang/Basic/Features.def Wed Jan 30 13:14:08 2019
@@ -95,7 +95,7 @@ FEATURE(objc_arc, LangOpts.ObjCAutoRefCo
 FEATURE(objc_arc_fields, true)
 FEATURE(objc_arc_weak, LangOpts.ObjCWeak)
 FEATURE(objc_default_synthesize_properties, LangOpts.ObjC)
-FEATURE(objc_fixed_enum, true)
+FEATURE(objc_fixed_enum, LangOpts.ObjC)
 FEATURE(objc_instancetype, LangOpts.ObjC)
 FEATURE(objc_kindof, LangOpts.ObjC)
 FEATURE(objc_modules, LangOpts.ObjC && LangOpts.Modules)

Modified: cfe/trunk/test/SemaObjC/enum-fixed-type.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/enum-fixed-type.m?rev=352672&r1=352671&r2=352672&view=diff
==============================================================================
--- cfe/trunk/test/SemaObjC/enum-fixed-type.m (original)
+++ cfe/trunk/test/SemaObjC/enum-fixed-type.m Wed Jan 30 13:14:08 2019
@@ -1,9 +1,11 @@
 // RUN: %clang_cc1 -fsyntax-only -pedantic -verify %s
 // RUN: %clang_cc1 -fsyntax-only -verify -xc %s
 
+#ifdef __OBJC__
 #if !__has_feature(objc_fixed_enum)
 #  error Enumerations with a fixed underlying type are not supported
 #endif
+#endif
 
 #if !__has_extension(cxx_fixed_enum)
 #  error Enumerations with a fixed underlying type are not supported




More information about the cfe-commits mailing list