From 756988e8f93b53a4196f44bf6ff3af75dcf3bfa3 Mon Sep 17 00:00:00 2001 From: matthias gatto Date: Thu, 10 Jan 2019 23:42:45 +0100 Subject: [PATCH] allow c11 feature only when -std=c11 is use --- tccgen.c | 5 +++++ tests/tests2/Makefile | 7 ++++++- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/tccgen.c b/tccgen.c index 06af3858..2c5830ce 100644 --- a/tccgen.c +++ b/tccgen.c @@ -4890,6 +4890,9 @@ ST_FUNC void unary(void) case TOK_ALIGNOF1: case TOK_ALIGNOF2: case TOK_ALIGNOF3: + if (tcc_state->cversion != 201112 && + tok == TOK_ALIGNOF3) + goto tok_identifier; t = tok; next(); in_sizeof++; @@ -5099,6 +5102,8 @@ ST_FUNC void unary(void) TokenString *str = NULL; int saved_const_wanted = const_wanted; + if (tcc_state->cversion != 201112) + goto tok_identifier; next(); skip('('); const_wanted = 0; diff --git a/tests/tests2/Makefile b/tests/tests2/Makefile index a5789c91..f1685e9e 100644 --- a/tests/tests2/Makefile +++ b/tests/tests2/Makefile @@ -42,11 +42,16 @@ NORUN = 42_function_pointer.test : NORUN = true # Some tests might need different flags +33_ternary_op.test : FLAGS += -std=c11 + FLAGS = 76_dollars_in_identifiers.test : FLAGS += -fdollars-in-identifiers # These tests run several snippets from the same file one by one -60_errors_and_warnings.test : FLAGS += -dt +60_errors_and_warnings.test : FLAGS += -dt -std=c11 + +94_generic.test : FLAGS += -std=c11 + 96_nodata_wanted.test : FLAGS += -dt # Always generate certain .expects (don't put these in the GIT),