<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;"><br><div><div>On Aug 26, 2014, at 1:15 PM, Richard Smith <<a href="mailto:richard@metafoo.co.uk">richard@metafoo.co.uk</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Aug 26, 2014 at 11:13 AM, Fariborz Jahanian <span dir="ltr"><<a href="mailto:fjahanian@apple.com" target="_blank">fjahanian@apple.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;">Author: fjahanian<br>
Date: Tue Aug 26 13:13:47 2014<br>
New Revision: 216469<br>
<br>
URL: <a href="http://llvm.org/viewvc/llvm-project?rev=216469&view=rev" target="_blank">http://llvm.org/viewvc/llvm-project?rev=216469&view=rev</a><br>
Log:<br>
c11- Check for c11 language option as documentation says<br>
feature is c11 about nested struct declarations must have<br>
struct-declarator-list. Without this change, code<br>
which was meant for c99 breaks. <a href="rdar://18125536">rdar://18125536</a><br></blockquote><div><br></div><div>This change does not look correct; the same rule existed in C89 and C99 too (but it was enforced by the grammar in those languages). [Additionally, your commit message is a bit garbled, you didn't add a new test case, and the only other information you provide is a link to an Apple-internal bug, so I'm not even sure what problem you're trying to fix.]</div></div></div></div></blockquote><div><br></div>Jordan checked and confirmed that rule is not in C99.</div><div>Test case is simple. This test causes a warning with default language setting C99 (without my patch).</div><div><br></div><div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">static struct S {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> struct INNER {</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> int totalNumSlots;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> };</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> // ...</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"> struct INNER externalFlows;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">} VVVVV;</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">I did not add new test because I changed several tests by either adding -std=c11 or in one case I kept the language default (c99)</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">and removed the warning instead. If this is insufficient I can add a test. But first we need to know if above test case</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">deserves a warning in c99 (and c89), in addition to c11.</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div><div style="margin: 0px; font-size: 11px; font-family: Menlo;">- Fariborz</div><div style="margin: 0px; font-size: 11px; font-family: Menlo;"><br></div></div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">
<div> </div><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex; position: static; z-index: auto;">
Modified:<br>
cfe/trunk/lib/Sema/SemaDecl.cpp<br>
cfe/trunk/test/CodeGen/ms-anonymous-struct.c<br>
cfe/trunk/test/Parser/declarators.c<br>
cfe/trunk/test/Sema/MicrosoftExtensions.c<br>
cfe/trunk/test/Sema/anonymous-struct-union.c<br>
cfe/trunk/test/SemaObjC/ivar-lookup.m<br>
<br>
Modified: cfe/trunk/lib/Sema/SemaDecl.cpp<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=216469&r1=216468&r2=216469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Sema/SemaDecl.cpp?rev=216469&r1=216468&r2=216469&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/lib/Sema/SemaDecl.cpp (original)<br>
+++ cfe/trunk/lib/Sema/SemaDecl.cpp Tue Aug 26 13:13:47 2014<br>
@@ -3450,7 +3450,7 @@ Decl *Sema::ParsedFreeStandingDeclSpec(S<br>
// C11 6.7.2.1p2:<br>
// A struct-declaration that does not declare an anonymous structure or<br>
// anonymous union shall contain a struct-declarator-list.<br>
- if (!getLangOpts().CPlusPlus && CurContext->isRecord() &&<br>
+ if (getLangOpts().C11 && CurContext->isRecord() &&<br>
DS.getStorageClassSpec() == DeclSpec::SCS_unspecified) {<br>
// Check for Microsoft C extension: anonymous struct/union member.<br>
// Handle 2 kinds of anonymous struct/union:<br>
<br>
Modified: cfe/trunk/test/CodeGen/ms-anonymous-struct.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-anonymous-struct.c?rev=216469&r1=216468&r2=216469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGen/ms-anonymous-struct.c?rev=216469&r1=216468&r2=216469&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/CodeGen/ms-anonymous-struct.c (original)<br>
+++ cfe/trunk/test/CodeGen/ms-anonymous-struct.c Tue Aug 26 13:13:47 2014<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -fms-extensions -emit-llvm -o - %s | FileCheck %s<br>
+// RUN: %clang_cc1 -std=c11 -fms-extensions -emit-llvm -o - %s | FileCheck %s<br>
<br>
// CHECK: %struct.test = type { i32, %struct.nested2, i32 }<br>
// CHECK: %struct.nested2 = type { i32, %struct.nested1, i32 }<br>
<br>
Modified: cfe/trunk/test/Parser/declarators.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/declarators.c?rev=216469&r1=216468&r2=216469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Parser/declarators.c?rev=216469&r1=216468&r2=216469&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Parser/declarators.c (original)<br>
+++ cfe/trunk/test/Parser/declarators.c Tue Aug 26 13:13:47 2014<br>
@@ -113,7 +113,6 @@ enum E1 { e1 }: // expected-error {{expe<br>
struct EnumBitfield { // expected-warning {{struct without named members is a GNU extension}}<br>
enum E2 { e2 } : 4; // ok<br>
struct S { int n; }: // expected-error {{expected ';'}}<br>
- // expected-warning@-1 {{declaration does not declare anything}}<br>
<br>
};<br>
<br>
<br>
Modified: cfe/trunk/test/Sema/MicrosoftExtensions.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftExtensions.c?rev=216469&r1=216468&r2=216469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/MicrosoftExtensions.c?rev=216469&r1=216468&r2=216469&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Sema/MicrosoftExtensions.c (original)<br>
+++ cfe/trunk/test/Sema/MicrosoftExtensions.c Tue Aug 26 13:13:47 2014<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -triple i686-windows %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions<br>
+// RUN: %clang_cc1 -std=c11 -triple i686-windows %s -fsyntax-only -Wno-unused-value -Wmicrosoft -verify -fms-extensions<br>
<br>
<br>
struct A<br>
<br>
Modified: cfe/trunk/test/Sema/anonymous-struct-union.c<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/anonymous-struct-union.c?rev=216469&r1=216468&r2=216469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/Sema/anonymous-struct-union.c?rev=216469&r1=216468&r2=216469&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/Sema/anonymous-struct-union.c (original)<br>
+++ cfe/trunk/test/Sema/anonymous-struct-union.c Tue Aug 26 13:13:47 2014<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -fsyntax-only -verify %s<br>
+// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify %s<br>
struct X {<br>
union {<br>
float f3;<br>
<br>
Modified: cfe/trunk/test/SemaObjC/ivar-lookup.m<br>
URL: <a href="http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/ivar-lookup.m?rev=216469&r1=216468&r2=216469&view=diff" target="_blank">http://llvm.org/viewvc/llvm-project/cfe/trunk/test/SemaObjC/ivar-lookup.m?rev=216469&r1=216468&r2=216469&view=diff</a><br>
==============================================================================<br>
--- cfe/trunk/test/SemaObjC/ivar-lookup.m (original)<br>
+++ cfe/trunk/test/SemaObjC/ivar-lookup.m Tue Aug 26 13:13:47 2014<br>
@@ -1,4 +1,4 @@<br>
-// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s<br>
+// RUN: %clang_cc1 -fsyntax-only -std=c11 -verify -Wno-objc-root-class %s<br>
<br>
@interface Test {<br>
int x;<br>
<br>
<br>
_______________________________________________<br>
cfe-commits mailing list<br>
<a href="mailto:cfe-commits@cs.uiuc.edu">cfe-commits@cs.uiuc.edu</a><br>
<a href="http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits" target="_blank">http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits</a><br>
</blockquote></div><br></div></div>
</blockquote></div><br></body></html>