aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRomain Francoise <rfrancoise@debian.org>2010-03-13 18:07:57 +0100
committerThomas Preud'homme <thomas.preudhomme@celest.fr>2010-04-15 19:04:25 +0200
commit6655e06ec851e3541f2f47187f95956e5003c7b8 (patch)
tree7d88b2fb5edc38017dff425a0e11151b68707d54
parentd2cf970a414ead8d90155c3569d9ab197cc099eb (diff)
downloadtinycc-6655e06ec851e3541f2f47187f95956e5003c7b8.tar.gz
tinycc-6655e06ec851e3541f2f47187f95956e5003c7b8.tar.bz2
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.
-rw-r--r--tccgen.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/tccgen.c b/tccgen.c
index 87c9f0d..1253d1e 100644
--- a/tccgen.c
+++ b/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;
}