diff --git a/tests/syntax/oracle/stmt_attributes.0.res.oracle b/tests/syntax/oracle/stmt_attributes.0.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..332ba0700ad1245f37109c60f9d9078089c05681 --- /dev/null +++ b/tests/syntax/oracle/stmt_attributes.0.res.oracle @@ -0,0 +1,9 @@ +[kernel] Parsing stmt_attributes.c (with preprocessing) +/* Generated by Frama-C */ +void f(void) +{ + foo: ; + return; +} + + diff --git a/tests/syntax/oracle/stmt_attributes.1.res.oracle b/tests/syntax/oracle/stmt_attributes.1.res.oracle new file mode 100644 index 0000000000000000000000000000000000000000..14c97664747e6a30d21ef1c09cd689609a652b8a --- /dev/null +++ b/tests/syntax/oracle/stmt_attributes.1.res.oracle @@ -0,0 +1,11 @@ +[kernel] Parsing stmt_attributes.c (with preprocessing) +[kernel] stmt_attributes.c:17: + syntax error: + Location: line 17, column 30, before or at token: ; + 15 attributes specifiers, which is forbidden, so a syntax error is raised. + 16 Statement attributes are not supported in frama-c except for labels. */ + 17 __attribute__((fallthrough)); + ^ + 18 #endif + 19 } +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/stmt_attributes.c b/tests/syntax/stmt_attributes.c new file mode 100644 index 0000000000000000000000000000000000000000..8b2e6ba682c36088b5380d3775cce372b419781c --- /dev/null +++ b/tests/syntax/stmt_attributes.c @@ -0,0 +1,19 @@ +/* run.config + STDOPT: + EXIT: 1 + STDOPT: #"-cpp-extra-args=-DNO_SPECIFIERS" +*/ + +void f() { + + /* Label attributes are accepted in Frama-C's parser, but dumped when building + Cabs. */ + foo: __attribute__((unused)); + + #ifdef NO_SPECIFIERS + /* Parser detect this as a declaration without any specifiers except for GCC's + attributes specifiers, which is forbidden, so a syntax error is raised. + Statement attributes are not supported in frama-c except for labels. */ + __attribute__((fallthrough)); + #endif +}