~sircmpwn/hare-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH harec] check: disallow C variadism in @init/@fini/@test

Details
Message ID
<20250117025729.20266-1-bgs@turminal.net>
Sender timestamp
1737086246
DKIM signature
pass
Download raw message
Patch: +7 -0
Breaking-Change: language
Signed-off-by: Bor Grošelj Simić <bgs@turminal.net>
---
 src/check.c              | 2 ++
 tests/34-declarations.ha | 5 +++++
 2 files changed, 7 insertions(+)

diff --git a/src/check.c b/src/check.c
index dd91dd88..eecb4470 100644
--- a/src/check.c
+++ b/src/check.c
@@ -3867,6 +3867,8 @@ check_function(struct context *ctx,
		}
		if (afndecl->prototype.params) {
			error(ctx, adecl->loc, NULL, "%s function cannot have parameters", flag);
		} else if (obj->type->func.variadism != VARIADISM_NONE) {
			error(ctx, adecl->loc, NULL, "%s function cannot be variadic", flag);
		}
	}

diff --git a/tests/34-declarations.ha b/tests/34-declarations.ha
index 8187d80f..d5b256f9 100644
--- a/tests/34-declarations.ha
+++ b/tests/34-declarations.ha
@@ -425,6 +425,11 @@ fn reject() void = {
		"@fini fn f() void;",
		"@test fn f() void;",

		// @init/@fini/@test with C variadism
		"@init fn f(...) void = void;",
		"@fini fn f(...) void = void;",
		"@test fn f(...) void = void;",

		// @symbol alongside other attributes
		`@symbol("foo") @init fn foo() void = void;`,
		`@symbol("foo") @fini fn foo() void = void;`,
-- 
2.47.1
Details
Message ID
<D78SPZC27DZ3.3E51C3VRAWV7U@d2evs.net>
In-Reply-To
<20250117025729.20266-1-bgs@turminal.net> (view parent)
Sender timestamp
1737568765
DKIM signature
pass
Download raw message
thanks!

to git@git.sr.ht:~sircmpwn/harec
  d1f1151..0b339b3  master -> master
Reply to thread Export thread (mbox)