diff options
author | Jakob Kaivo <jkk@ung.org> | 2022-10-30 19:07:53 -0400 |
---|---|---|
committer | Jakob Kaivo <jkk@ung.org> | 2022-10-30 19:07:53 -0400 |
commit | 5172d87ae82cf2f45747bdc1833016898c708d60 (patch) | |
tree | a5827bc947cb480e79d6b7391c6b7d3c2174f408 | |
parent | a3147db72475e49534dd627d2388bae78967743d (diff) |
add several new examplesHEADundefined-samplesmaster
-rw-r--r-- | ctype-function-parameter-not-representable.c | 12 | ||||
-rw-r--r-- | declaring-a-variable-of-incomplete-type.c | 4 | ||||
-rw-r--r-- | execution-reaches-end-brace-of-function.c | 8 | ||||
-rw-r--r-- | function-declared-extern-inline.c | 6 | ||||
-rw-r--r-- | manually-declaring-__func__.c | 5 | ||||
-rw-r--r-- | modifying-a-string-literal.c | 8 | ||||
-rw-r--r-- | returning-from-a-_Noreturn-function.c | 9 | ||||
-rw-r--r-- | undefined-extern-variable.c | 6 | ||||
-rw-r--r-- | undefined-preprocessor-directive.c | 1 | ||||
-rw-r--r-- | undefining-a-predefined-macro.c | 1 |
10 files changed, 60 insertions, 0 deletions
diff --git a/ctype-function-parameter-not-representable.c b/ctype-function-parameter-not-representable.c new file mode 100644 index 0000000..0fb5698 --- /dev/null +++ b/ctype-function-parameter-not-representable.c @@ -0,0 +1,12 @@ +#include <stdio.h> +#include <ctype.h> +#include <limits.h> + +int main(void) +{ + int c = UCHAR_MAX + 1; + if (c == EOF) { + c++; + } + return isalpha(c); +} diff --git a/declaring-a-variable-of-incomplete-type.c b/declaring-a-variable-of-incomplete-type.c new file mode 100644 index 0000000..2502b8f --- /dev/null +++ b/declaring-a-variable-of-incomplete-type.c @@ -0,0 +1,4 @@ +int main(void) +{ + struct foo foo; +} diff --git a/execution-reaches-end-brace-of-function.c b/execution-reaches-end-brace-of-function.c new file mode 100644 index 0000000..4f22dd5 --- /dev/null +++ b/execution-reaches-end-brace-of-function.c @@ -0,0 +1,8 @@ +int foo(void) +{ +} + +int main(void) +{ + return foo(); +} diff --git a/function-declared-extern-inline.c b/function-declared-extern-inline.c new file mode 100644 index 0000000..bc403fd --- /dev/null +++ b/function-declared-extern-inline.c @@ -0,0 +1,6 @@ +extern inline int foo(void); + +int main(void) +{ + return foo(); +} diff --git a/manually-declaring-__func__.c b/manually-declaring-__func__.c new file mode 100644 index 0000000..df53006 --- /dev/null +++ b/manually-declaring-__func__.c @@ -0,0 +1,5 @@ +int main(void) +{ + int __func__ = 0; + return __func__; +} diff --git a/modifying-a-string-literal.c b/modifying-a-string-literal.c new file mode 100644 index 0000000..bebabbf --- /dev/null +++ b/modifying-a-string-literal.c @@ -0,0 +1,8 @@ +#include <stdio.h> + +int main(void) +{ + char *s = "foo"; + s[0] = 'b'; + puts(s); +} diff --git a/returning-from-a-_Noreturn-function.c b/returning-from-a-_Noreturn-function.c new file mode 100644 index 0000000..ec072be --- /dev/null +++ b/returning-from-a-_Noreturn-function.c @@ -0,0 +1,9 @@ +_Noreturn void foo(void) +{ + return; +} + +int main(void) +{ + foo(); +} diff --git a/undefined-extern-variable.c b/undefined-extern-variable.c new file mode 100644 index 0000000..2ff2e4b --- /dev/null +++ b/undefined-extern-variable.c @@ -0,0 +1,6 @@ +extern int bar; + +int main(void) +{ + return bar; +} diff --git a/undefined-preprocessor-directive.c b/undefined-preprocessor-directive.c new file mode 100644 index 0000000..e4762de --- /dev/null +++ b/undefined-preprocessor-directive.c @@ -0,0 +1 @@ +#hello diff --git a/undefining-a-predefined-macro.c b/undefining-a-predefined-macro.c new file mode 100644 index 0000000..d6804d7 --- /dev/null +++ b/undefining-a-predefined-macro.c @@ -0,0 +1 @@ +#undef __STDC__ |