mirror of
https://github.com/mirror/tinycc.git
synced 2024-12-26 03:50:07 +08:00
Error out on bad char array initialization
Error out with an explicit message when trying to initialize a character array with something that's not a literal (optionally enclosed in braces) as per C99 6.7.8:14; thanks to Antti-Juhani Kaijanaho <ajk@debian.org> who did all the work.
This commit is contained in:
parent
d2cf970a41
commit
6655e06ec8
3
tccgen.c
3
tccgen.c
@ -4690,6 +4690,9 @@ static void decl_initializer(CType *type, Section *sec, unsigned long c,
|
||||
no_oblock = 1;
|
||||
if ((first && tok != TOK_LSTR && tok != TOK_STR) ||
|
||||
tok == '{') {
|
||||
if (tok != '{')
|
||||
error("character array initializer must be a literal,"
|
||||
" optionally enclosed in braces");
|
||||
skip('{');
|
||||
no_oblock = 0;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user