Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 10 Jul 2019 05:57:37 +0000 (UTC)
From:      Dimitry Andric <dim@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r349876 - head/contrib/llvm/tools/clang/include/clang/AST
Message-ID:  <201907100557.x6A5vbeE047853@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: dim
Date: Wed Jul 10 05:57:37 2019
New Revision: 349876
URL: https://svnweb.freebsd.org/changeset/base/349876

Log:
  Apply a workaround to be able to build clang 8.0.0 headers with clang
  3.4.1, which is still in the stable/10 branch.
  
  It looks like clang 3.4.1 implements static_asserts by instantiating a
  temporary static object, and if those are in an anonymous union, it
  results in "error: anonymous union can only contain non-static data
  members".
  
  To work around this implementation limitation, move the static_asserts
  in question out of the anonymous unions.
  
  This should make building the latest stable/11 from stable/10 possible
  again.
  
  Reported by:	Mike Tancsa <mike@sentex.net>
  MFC after:	3 days

Modified:
  head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h
  head/contrib/llvm/tools/clang/include/clang/AST/Type.h

Modified: head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h	Wed Jul 10 05:45:50 2019	(r349875)
+++ head/contrib/llvm/tools/clang/include/clang/AST/DeclBase.h	Wed Jul 10 05:57:37 2019	(r349876)
@@ -1696,30 +1696,30 @@ class DeclContext { (protected)
     ObjCContainerDeclBitfields ObjCContainerDeclBits;
     LinkageSpecDeclBitfields LinkageSpecDeclBits;
     BlockDeclBitfields BlockDeclBits;
-
-    static_assert(sizeof(DeclContextBitfields) <= 8,
-                  "DeclContextBitfields is larger than 8 bytes!");
-    static_assert(sizeof(TagDeclBitfields) <= 8,
-                  "TagDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(EnumDeclBitfields) <= 8,
-                  "EnumDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(RecordDeclBitfields) <= 8,
-                  "RecordDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8,
-                  "OMPDeclareReductionDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(FunctionDeclBitfields) <= 8,
-                  "FunctionDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(CXXConstructorDeclBitfields) <= 8,
-                  "CXXConstructorDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(ObjCMethodDeclBitfields) <= 8,
-                  "ObjCMethodDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(ObjCContainerDeclBitfields) <= 8,
-                  "ObjCContainerDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(LinkageSpecDeclBitfields) <= 8,
-                  "LinkageSpecDeclBitfields is larger than 8 bytes!");
-    static_assert(sizeof(BlockDeclBitfields) <= 8,
-                  "BlockDeclBitfields is larger than 8 bytes!");
   };
+
+  static_assert(sizeof(DeclContextBitfields) <= 8,
+                "DeclContextBitfields is larger than 8 bytes!");
+  static_assert(sizeof(TagDeclBitfields) <= 8,
+                "TagDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(EnumDeclBitfields) <= 8,
+                "EnumDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(RecordDeclBitfields) <= 8,
+                "RecordDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(OMPDeclareReductionDeclBitfields) <= 8,
+                "OMPDeclareReductionDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(FunctionDeclBitfields) <= 8,
+                "FunctionDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(CXXConstructorDeclBitfields) <= 8,
+                "CXXConstructorDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(ObjCMethodDeclBitfields) <= 8,
+                "ObjCMethodDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(ObjCContainerDeclBitfields) <= 8,
+                "ObjCContainerDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(LinkageSpecDeclBitfields) <= 8,
+                "LinkageSpecDeclBitfields is larger than 8 bytes!");
+  static_assert(sizeof(BlockDeclBitfields) <= 8,
+                "BlockDeclBitfields is larger than 8 bytes!");
 
   /// FirstDecl - The first declaration stored within this declaration
   /// context.

Modified: head/contrib/llvm/tools/clang/include/clang/AST/Type.h
==============================================================================
--- head/contrib/llvm/tools/clang/include/clang/AST/Type.h	Wed Jul 10 05:45:50 2019	(r349875)
+++ head/contrib/llvm/tools/clang/include/clang/AST/Type.h	Wed Jul 10 05:57:37 2019	(r349876)
@@ -1720,41 +1720,41 @@ class Type : public ExtQualsTypeCommonBase { (protecte
     DependentTemplateSpecializationTypeBitfields
       DependentTemplateSpecializationTypeBits;
     PackExpansionTypeBitfields PackExpansionTypeBits;
-
-    static_assert(sizeof(TypeBitfields) <= 8,
-                  "TypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(ArrayTypeBitfields) <= 8,
-                  "ArrayTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(AttributedTypeBitfields) <= 8,
-                  "AttributedTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(AutoTypeBitfields) <= 8,
-                  "AutoTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(BuiltinTypeBitfields) <= 8,
-                  "BuiltinTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(FunctionTypeBitfields) <= 8,
-                  "FunctionTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(ObjCObjectTypeBitfields) <= 8,
-                  "ObjCObjectTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(ReferenceTypeBitfields) <= 8,
-                  "ReferenceTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(TypeWithKeywordBitfields) <= 8,
-                  "TypeWithKeywordBitfields is larger than 8 bytes!");
-    static_assert(sizeof(ElaboratedTypeBitfields) <= 8,
-                  "ElaboratedTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(VectorTypeBitfields) <= 8,
-                  "VectorTypeBitfields is larger than 8 bytes!");
-    static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8,
-                  "SubstTemplateTypeParmPackTypeBitfields is larger"
-                  " than 8 bytes!");
-    static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8,
-                  "TemplateSpecializationTypeBitfields is larger"
-                  " than 8 bytes!");
-    static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8,
-                  "DependentTemplateSpecializationTypeBitfields is larger"
-                  " than 8 bytes!");
-    static_assert(sizeof(PackExpansionTypeBitfields) <= 8,
-                  "PackExpansionTypeBitfields is larger than 8 bytes");
   };
+
+  static_assert(sizeof(TypeBitfields) <= 8,
+		"TypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(ArrayTypeBitfields) <= 8,
+		"ArrayTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(AttributedTypeBitfields) <= 8,
+		"AttributedTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(AutoTypeBitfields) <= 8,
+		"AutoTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(BuiltinTypeBitfields) <= 8,
+		"BuiltinTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(FunctionTypeBitfields) <= 8,
+		"FunctionTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(ObjCObjectTypeBitfields) <= 8,
+		"ObjCObjectTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(ReferenceTypeBitfields) <= 8,
+		"ReferenceTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(TypeWithKeywordBitfields) <= 8,
+		"TypeWithKeywordBitfields is larger than 8 bytes!");
+  static_assert(sizeof(ElaboratedTypeBitfields) <= 8,
+		"ElaboratedTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(VectorTypeBitfields) <= 8,
+		"VectorTypeBitfields is larger than 8 bytes!");
+  static_assert(sizeof(SubstTemplateTypeParmPackTypeBitfields) <= 8,
+		"SubstTemplateTypeParmPackTypeBitfields is larger"
+		" than 8 bytes!");
+  static_assert(sizeof(TemplateSpecializationTypeBitfields) <= 8,
+		"TemplateSpecializationTypeBitfields is larger"
+		" than 8 bytes!");
+  static_assert(sizeof(DependentTemplateSpecializationTypeBitfields) <= 8,
+		"DependentTemplateSpecializationTypeBitfields is larger"
+		" than 8 bytes!");
+  static_assert(sizeof(PackExpansionTypeBitfields) <= 8,
+		"PackExpansionTypeBitfields is larger than 8 bytes");
 
 private:
   template <class T> friend class TypePropertyCache;



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201907100557.x6A5vbeE047853>