forked from OSchip/llvm-project
c11- Check for c11 language option as documentation says
feature is c11 about nested struct declarations must have struct-declarator-list. Without this change, code which was meant for c99 breaks. rdar://18125536 llvm-svn: 216469
This commit is contained in:
parent
5c4f4a6c33
commit
840438bb06
|
@ -3450,7 +3450,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(Scope *S, AccessSpecifier AS,
|
|||
// C11 6.7.2.1p2:
|
||||
// A struct-declaration that does not declare an anonymous structure or
|
||||
// anonymous union shall contain a struct-declarator-list.
|
||||
if (!getLangOpts().CPlusPlus && CurContext->isRecord() &&
|
||||
if (getLangOpts().C11 && CurContext->isRecord() &&
|
||||
DS.getStorageClassSpec() == DeclSpec::SCS_unspecified) {
|
||||
// Check for Microsoft C extension: anonymous struct/union member.
|
||||
// Handle 2 kinds of anonymous struct/union:
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fms-extensions -emit-llvm -o - %s | FileCheck %s
|
||||
// RUN: %clang_cc1 -std=c11 -fms-extensions -emit-llvm -o - %s | FileCheck %s
|
||||
|
||||
// CHECK: %struct.test = type { i32, %struct.nested2, i32 }
|
||||
// CHECK: %struct.nested2 = type { i32, %struct.nested1, i32 }
|
||||
|
|
|
@ -113,7 +113,6 @@ enum E1 { e1 }: // expected-error {{expected ';'}}
|
|||
struct EnumBitfield { // expected-warning {{struct without named members is a GNU extension}}
|
||||
enum E2 { e2 } : 4; // ok
|
||||
struct S { int n; }: // expected-error {{expected ';'}}
|
||||
// expected-warning@-1 {{declaration does not declare anything}}
|
||||
|
||||
};
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -triple i686-windows %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
|
||||
// RUN: %clang_cc1 -std=c11 -triple i686-windows %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions
|
||||
|
||||
|
||||
struct A
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify %s
|
||||
struct X {
|
||||
union {
|
||||
float f3;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s
|
||||
// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify -Wno-objc-root-class %s
|
||||
|
||||
@interface Test {
|
||||
int x;
|
||||
|
|
Loading…
Reference in New Issue