aboutsummaryrefslogtreecommitdiff
path: root/tinycc/tests/tests2/17_enum.c
diff options
context:
space:
mode:
authorUneven Prankster <unevenprankster@protonmail.com>2023-07-17 01:34:34 -0300
committerUneven Prankster <unevenprankster@protonmail.com>2023-07-17 01:34:34 -0300
commit88d82c6eaee88398af1de57cddca692a1f74b087 (patch)
treedf492c2002a1820959703f4f481172cceafeb0a1 /tinycc/tests/tests2/17_enum.c
parent111c133b939c15c57c90cd474d55e84928c6307a (diff)
Cleanup feels good! Big work coming up this week.
Diffstat (limited to 'tinycc/tests/tests2/17_enum.c')
-rw-r--r--tinycc/tests/tests2/17_enum.c72
1 files changed, 0 insertions, 72 deletions
diff --git a/tinycc/tests/tests2/17_enum.c b/tinycc/tests/tests2/17_enum.c
deleted file mode 100644
index e2bc736..0000000
--- a/tinycc/tests/tests2/17_enum.c
+++ /dev/null
@@ -1,72 +0,0 @@
-#include <stdio.h>
-
-enum fred
-{
- a,
- b,
- c,
- d,
- e = 54,
- f = 73,
- g,
- h
-};
-
-/* All following uses of enum efoo should compile
- without warning. While forward enums aren't ISO C,
- it's accepted by GCC also in strict mode, and only warned
- about with -pedantic. This happens in the real world. */
-/* Strict ISO C doesn't allow this kind of forward declaration of
- enums, but GCC accepts it (and gives only pedantic warning), and
- it occurs in the wild. */
-enum efoo;
-struct Sforward_use {
- int (*fmember) (enum efoo x);
-};
-
-extern enum efoo it_real_fn(void);
-enum efoo {
- ONE,
- TWO,
-};
-struct S2 {
- enum efoo (*f2) (void);
-};
-void should_compile(struct S2 *s)
-{
- s->f2 = it_real_fn;
-}
-
-enum efoo it_real_fn(void)
-{
- return TWO;
-}
-
-static unsigned int deref_uintptr(unsigned int *p)
-{
- return *p;
-}
-
-enum Epositive {
- epos_one, epos_two
-};
-
-int main()
-{
- enum fred frod;
- enum Epositive epos = epos_two;
-
- printf("%d %d %d %d %d %d %d %d\n", a, b, c, d, e, f, g, h);
- /* printf("%d\n", frod); */
- frod = 12;
- printf("%d\n", frod);
- frod = e;
- printf("%d\n", frod);
-
- /* Following should compile without warning. */
- printf ("enum to int: %u\n", deref_uintptr(&epos));
-
- return 0;
-}
-
-/* vim: set expandtab ts=4 sw=3 sts=3 tw=80 :*/