aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/Sema/SemaInit.cpp2
-rw-r--r--test/Analysis/stack-addr-ps.c2
-rw-r--r--test/Sema/array-init.c2
-rw-r--r--test/Sema/compound-literal.c2
4 files changed, 4 insertions, 4 deletions
diff --git a/lib/Sema/SemaInit.cpp b/lib/Sema/SemaInit.cpp
index a8a0ea3aea..17113f68bd 100644
--- a/lib/Sema/SemaInit.cpp
+++ b/lib/Sema/SemaInit.cpp
@@ -538,7 +538,7 @@ void InitListChecker::CheckExplicitInitList(InitListExpr *IList, QualType &T,
}
}
- if (T->isScalarType())
+ if (T->isScalarType() && !TopLevelObject)
SemaRef.Diag(IList->getLocStart(), diag::warn_braces_around_scalar_init)
<< IList->getSourceRange()
<< CodeModificationHint::CreateRemoval(SourceRange(IList->getLocStart()))
diff --git a/test/Analysis/stack-addr-ps.c b/test/Analysis/stack-addr-ps.c
index aa3c135f37..4bc9a7def2 100644
--- a/test/Analysis/stack-addr-ps.c
+++ b/test/Analysis/stack-addr-ps.c
@@ -24,7 +24,7 @@ int* f3(int x, int *y) {
void* compound_literal(int x, int y) {
if (x)
- return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}} expected-warning{{braces around scalar initializer}}
+ return &(unsigned short){((unsigned short)0x22EF)}; // expected-warning{{Address of stack memory}}
int* array[] = {};
struct s { int z; double y; int w; };
diff --git a/test/Sema/array-init.c b/test/Sema/array-init.c
index 4e95a01876..dfaaa87ef5 100644
--- a/test/Sema/array-init.c
+++ b/test/Sema/array-init.c
@@ -20,7 +20,7 @@ void func() {
int x3[x] = { 1, 2 }; // expected-error{{variable-sized object may not be initialized}}
- int x4 = { 1, 2 }; // expected-warning{{braces around scalar initializer}} expected-warning{{excess elements in scalar initializer}}
+ int x4 = { 1, 2 }; // expected-warning{{excess elements in scalar initializer}}
int y[4][3] = {
{ 1, 3, 5 },
diff --git a/test/Sema/compound-literal.c b/test/Sema/compound-literal.c
index 24ec223ae6..b51bcfe2a2 100644
--- a/test/Sema/compound-literal.c
+++ b/test/Sema/compound-literal.c
@@ -6,7 +6,7 @@ static struct foo t = (struct foo){0,0};
static struct foo t2 = {0,0};
static struct foo t3 = t2; // -expected-error {{initializer element is not a compile-time constant}}
static int *p = (int []){2,4};
-static int x = (int){1}; // -expected-warning{{braces around scalar initializer}}
+static int x = (int){1};
static int *p2 = (int []){2,x}; // -expected-error {{initializer element is not a compile-time constant}}
static long *p3 = (long []){2,"x"}; // -expected-warning {{incompatible pointer to integer conversion initializing 'char [2]', expected 'long'}}