From 74dc911b77d7c1eb794c16fcaffb9fa04516167c Mon Sep 17 00:00:00 2001 From: Andre Maroneze <andre.maroneze@cea.fr> Date: Tue, 12 Oct 2021 16:15:04 +0200 Subject: [PATCH] add test case for unsupported C11 keywords --- tests/syntax/c11-keywords.c | 35 +++++++++++++++++++ tests/syntax/oracle/c11-keywords.0.res.oracle | 6 ++++ tests/syntax/oracle/c11-keywords.1.res.oracle | 6 ++++ tests/syntax/oracle/c11-keywords.2.res.oracle | 6 ++++ tests/syntax/oracle/c11-keywords.3.res.oracle | 6 ++++ tests/syntax/oracle/c11-keywords.4.res.oracle | 6 ++++ 6 files changed, 65 insertions(+) create mode 100644 tests/syntax/c11-keywords.c create mode 100644 tests/syntax/oracle/c11-keywords.0.res.oracle create mode 100644 tests/syntax/oracle/c11-keywords.1.res.oracle create mode 100644 tests/syntax/oracle/c11-keywords.2.res.oracle create mode 100644 tests/syntax/oracle/c11-keywords.3.res.oracle create mode 100644 tests/syntax/oracle/c11-keywords.4.res.oracle diff --git a/tests/syntax/c11-keywords.c b/tests/syntax/c11-keywords.c new file mode 100644 index 00000000000..ea34e4f25ff --- /dev/null +++ b/tests/syntax/c11-keywords.c @@ -0,0 +1,35 @@ +/* run.config + EXIT: 1 + STDOPT: #"-cpp-extra-args=-DALIGNAS" + STDOPT: #"-cpp-extra-args=-DALIGNOF" + STDOPT: #"-cpp-extra-args=-DCOMPLEX" + STDOPT: #"-cpp-extra-args=-DGENERIC" + STDOPT: #"-cpp-extra-args=-DIMAGINARY" +*/ + +#ifdef ALIGNAS +struct st_alignas { + _Alignas(32) char buf[4]; +}; +#endif + +int main(void) { +#ifdef ALIGNOF + int alignd = _Alignof(double); +#endif + +#ifdef COMPLEX + double _Complex c = 1; +#endif + +#ifdef GENERIC + int generic = _Generic('0', char: 1, int: 2, default: 0); +#endif + +#ifdef IMAGINARY + //Note: GCC/Clang do not yet support _Imaginary + double _Imaginary im = 0; +#endif + + return 0; +} diff --git a/tests/syntax/oracle/c11-keywords.0.res.oracle b/tests/syntax/oracle/c11-keywords.0.res.oracle new file mode 100644 index 00000000000..226f1b7db04 --- /dev/null +++ b/tests/syntax/oracle/c11-keywords.0.res.oracle @@ -0,0 +1,6 @@ +[kernel] Parsing tests/syntax/c11-keywords.c (with preprocessing) +[kernel] tests/syntax/c11-keywords.c:12: Failure: + _Alignas is currently unsupported by Frama-C. +[kernel] User Error: stopping on file "tests/syntax/c11-keywords.c" that has errors. Add + '-kernel-msg-key pp' for preprocessing command. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/c11-keywords.1.res.oracle b/tests/syntax/oracle/c11-keywords.1.res.oracle new file mode 100644 index 00000000000..f85b77e4dae --- /dev/null +++ b/tests/syntax/oracle/c11-keywords.1.res.oracle @@ -0,0 +1,6 @@ +[kernel] Parsing tests/syntax/c11-keywords.c (with preprocessing) +[kernel] tests/syntax/c11-keywords.c:18: Failure: + _Alignof is currently unsupported by Frama-C. +[kernel] User Error: stopping on file "tests/syntax/c11-keywords.c" that has errors. Add + '-kernel-msg-key pp' for preprocessing command. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/c11-keywords.2.res.oracle b/tests/syntax/oracle/c11-keywords.2.res.oracle new file mode 100644 index 00000000000..7e887a95762 --- /dev/null +++ b/tests/syntax/oracle/c11-keywords.2.res.oracle @@ -0,0 +1,6 @@ +[kernel] Parsing tests/syntax/c11-keywords.c (with preprocessing) +[kernel] tests/syntax/c11-keywords.c:22: Failure: + _Complex is currently unsupported by Frama-C. +[kernel] User Error: stopping on file "tests/syntax/c11-keywords.c" that has errors. Add + '-kernel-msg-key pp' for preprocessing command. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/c11-keywords.3.res.oracle b/tests/syntax/oracle/c11-keywords.3.res.oracle new file mode 100644 index 00000000000..8cd9fbf7dc4 --- /dev/null +++ b/tests/syntax/oracle/c11-keywords.3.res.oracle @@ -0,0 +1,6 @@ +[kernel] Parsing tests/syntax/c11-keywords.c (with preprocessing) +[kernel] tests/syntax/c11-keywords.c:26: Failure: + _Generic is currently unsupported by Frama-C. +[kernel] User Error: stopping on file "tests/syntax/c11-keywords.c" that has errors. Add + '-kernel-msg-key pp' for preprocessing command. +[kernel] Frama-C aborted: invalid user input. diff --git a/tests/syntax/oracle/c11-keywords.4.res.oracle b/tests/syntax/oracle/c11-keywords.4.res.oracle new file mode 100644 index 00000000000..188b0e56165 --- /dev/null +++ b/tests/syntax/oracle/c11-keywords.4.res.oracle @@ -0,0 +1,6 @@ +[kernel] Parsing tests/syntax/c11-keywords.c (with preprocessing) +[kernel] tests/syntax/c11-keywords.c:31: Failure: + _Imaginary is currently unsupported by Frama-C. +[kernel] User Error: stopping on file "tests/syntax/c11-keywords.c" that has errors. Add + '-kernel-msg-key pp' for preprocessing command. +[kernel] Frama-C aborted: invalid user input. -- GitLab