mirror of
https://github.com/cc65/cc65.git
synced 2024-12-27 00:29:31 +00:00
Warn for braces around a pointer initializer.
This commit is contained in:
parent
5e5dd1d6c4
commit
3c5269dede
@ -302,6 +302,13 @@ static unsigned ParsePointerInit (const Type* T)
|
||||
/* Optional opening brace */
|
||||
unsigned BraceCount = OpeningCurlyBraces (0);
|
||||
|
||||
/* We warn if an initializer for a scalar contains braces, because this is
|
||||
** quite unusual and often a sign for some problem in the input.
|
||||
*/
|
||||
if (BraceCount > 0) {
|
||||
Warning ("Braces around scalar initializer");
|
||||
}
|
||||
|
||||
/* Expression */
|
||||
ExprDesc ED = NoCodeConstExpr (hie1);
|
||||
TypeConversion (&ED, T);
|
||||
|
2
test/ref/bug2134.c
Normal file
2
test/ref/bug2134.c
Normal file
@ -0,0 +1,2 @@
|
||||
int i = { 0 };
|
||||
char* p = { 0 };
|
2
test/ref/bug2134.cref
Normal file
2
test/ref/bug2134.cref
Normal file
@ -0,0 +1,2 @@
|
||||
bug2134.c:1: Warning: Braces around scalar initializer
|
||||
bug2134.c:2: Warning: Braces around scalar initializer
|
Loading…
Reference in New Issue
Block a user