diff options
author | Michael Forney <mforney@mforney.org> | 2024-04-14 23:12:21 -0700 |
---|---|---|
committer | Michael Forney <mforney@mforney.org> | 2024-04-15 01:23:59 -0700 |
commit | cc49fbc44550d3927c592445a3e7f89a4481a63a (patch) | |
tree | 570910b0eb05abac46fe60fba4fbce304ef15a40 /test | |
parent | 7ee038a55d70ffb94139869acf423ebe0dd52b70 (diff) |
Remove support for non-prototype function declarations and definitions
These were removed in C23.
Diffstat (limited to 'test')
-rw-r--r-- | test/compatible-function-types.c | 30 | ||||
-rw-r--r-- | test/compatible-function-types.qbe | 16 | ||||
-rw-r--r-- | test/float-promote.c | 10 | ||||
-rw-r--r-- | test/float-promote.qbe | 6 | ||||
-rw-r--r-- | test/kr-function-argument-promotion.c | 10 | ||||
-rw-r--r-- | test/kr-function-argument-promotion.qbe | 18 | ||||
-rw-r--r-- | test/lvalue-conversion.c | 2 |
7 files changed, 23 insertions, 69 deletions
diff --git a/test/compatible-function-types.c b/test/compatible-function-types.c index 4dcd877..1f67cd6 100644 --- a/test/compatible-function-types.c +++ b/test/compatible-function-types.c @@ -1,20 +1,22 @@ void f1(); -void f1(int, void *); +void f1(void); -int f2(); -int f2(double); +void f2(int, char *); +void f2(int, char *); -void f3() {} -void f3(void); +void f3(int(const double)); +void f3(int (*)(double)); -void f4(int, char *); -void f4(int, char *); +void f4(const char *, ...); +void f5(const char[], ...); -void f5(x, y) unsigned x; double y; {} -void f5(unsigned, double); +void f6(const int); +void f6(int); -void f6(const char *, ...); -void f6(const char[], ...); - -void f7(const int); -void f7(int); +static_assert(!__builtin_types_compatible_p(void(), void(int))); +static_assert(!__builtin_types_compatible_p(void(int), void(char))); +static_assert(!__builtin_types_compatible_p(int(float), char(float))); +static_assert(!__builtin_types_compatible_p(void(int, ...), void(int))); +static_assert(!__builtin_types_compatible_p(void(const char *), void(char *))); +static_assert(!__builtin_types_compatible_p(void(char *), void(unsigned char *))); +static_assert(!__builtin_types_compatible_p(void(int, float), void(int, double))); diff --git a/test/compatible-function-types.qbe b/test/compatible-function-types.qbe index 27d9b32..e69de29 100644 --- a/test/compatible-function-types.qbe +++ b/test/compatible-function-types.qbe @@ -1,16 +0,0 @@ -export -function $f3() { -@start.1 -@body.2 - ret -} -export -function $f5(w %.1, d %.3) { -@start.3 - %.2 =l alloc4 4 - storew %.1, %.2 - %.4 =l alloc8 8 - stored %.3, %.4 -@body.4 - ret -} diff --git a/test/float-promote.c b/test/float-promote.c index 572719a..22e9fa7 100644 --- a/test/float-promote.c +++ b/test/float-promote.c @@ -1,8 +1,6 @@ -void g1(); -void g2(int, ...); -void g3(float); +void g1(int, ...); +void g2(float); void f(void) { - g1(1.0f); - g2(0, 1.0f); - g3(1.0f); + g1(0, 1.0f); + g2(1.0f); } diff --git a/test/float-promote.qbe b/test/float-promote.qbe index 97638e7..069b939 100644 --- a/test/float-promote.qbe +++ b/test/float-promote.qbe @@ -3,9 +3,7 @@ function $f() { @start.1 @body.2 %.1 =d exts s_1 - call $g1(d %.1) - %.2 =d exts s_1 - call $g2(w 0, ..., d %.2) - call $g3(s s_1) + call $g1(w 0, ..., d %.1) + call $g2(s s_1) ret } diff --git a/test/kr-function-argument-promotion.c b/test/kr-function-argument-promotion.c deleted file mode 100644 index 7592da1..0000000 --- a/test/kr-function-argument-promotion.c +++ /dev/null @@ -1,10 +0,0 @@ -int f(c) - unsigned char c; -{ - return c; -} - -int main(void) -{ - return f(0x100); -} diff --git a/test/kr-function-argument-promotion.qbe b/test/kr-function-argument-promotion.qbe deleted file mode 100644 index 6d2f2b8..0000000 --- a/test/kr-function-argument-promotion.qbe +++ /dev/null @@ -1,18 +0,0 @@ -export -function w $f(w %.1) { -@start.1 - %.2 =w extub %.1 - %.3 =l alloc4 1 - storeb %.2, %.3 -@body.2 - %.4 =w loadub %.3 - %.5 =w extub %.4 - ret %.5 -} -export -function w $main() { -@start.3 -@body.4 - %.1 =w call $f(w 256) - ret %.1 -} diff --git a/test/lvalue-conversion.c b/test/lvalue-conversion.c index 6bbc326..a9bce10 100644 --- a/test/lvalue-conversion.c +++ b/test/lvalue-conversion.c @@ -1,4 +1,4 @@ -void g(); +void g(int); void f(void) { static const unsigned char c = 0; g(c); |