diff options
author | Vitaly Cheptsov <4348897+vit9696@users.noreply.github.com> | 2021-08-31 16:05:01 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-31 06:05:01 -0700 |
commit | b1dbdc5e21346de0fec7fbb814dedbe1585bcfec (patch) | |
tree | f39a2416a742dcbf4193b96e7f8aa10c38d2618e /tests/c_files | |
parent | 302855a6f30bdec33614a145f1dbe031316f351a (diff) | |
download | pycparser-b1dbdc5e21346de0fec7fbb814dedbe1585bcfec.tar.gz |
Introduce partial C11 support (#429)
* Introduce partial C11 support
Implemented _Noreturn, _Static_assert, _Thread_local. Also fixed
tests with preprocessor on macOS.
* Add more tests
Co-authored-by: vit9696 <vit9696@users.noreply.github.com>
Diffstat (limited to 'tests/c_files')
-rw-r--r-- | tests/c_files/c11.c | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/c_files/c11.c b/tests/c_files/c11.c new file mode 100644 index 0000000..854feba --- /dev/null +++ b/tests/c_files/c11.c @@ -0,0 +1,31 @@ +#include <stdio.h>
+#include <stdlib.h>
+#include <stdnoreturn.h>
+#include <threads.h>
+#include <assert.h>
+
+/* C11 thread locals */
+_Thread_local int flag;
+thread_local int flag2;
+
+static_assert(sizeof(flag) == sizeof(flag2), "Really unexpected size difference");
+
+noreturn void func2(void)
+{
+ abort();
+}
+
+_Noreturn void func(void)
+{
+ func2();
+}
+
+int main()
+{
+ _Static_assert(sizeof(flag) == sizeof(flag2), "Unexpected size difference");
+ static_assert(sizeof(flag) == sizeof(flag2), "Unexpected size difference");
+
+ printf("Flag: %d\n", flag);
+ printf("Flag2: %d\n", flag2);
+ func();
+}
|