Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature request] Warn when a macro argument is not used #1579

Open
ISSOtm opened this issue Dec 18, 2024 · 1 comment
Open

[Feature request] Warn when a macro argument is not used #1579

ISSOtm opened this issue Dec 18, 2024 · 1 comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM

Comments

@ISSOtm
Copy link
Member

ISSOtm commented Dec 18, 2024

Macros will, logically, error out when they are passed too few arguments. But, by nature, extraneous arguments are simply ignored. This can be intentional, but I expect that this would be rare; so, I'm suggesting -Wunused-macro-arg enabled by -Wall.

In theory, we could also add some syntax for macros to specify how many arguments they want to be given; but I expect that adoption would be low, and thus I'm not sure it would be worth the implementation effort.

@ISSOtm ISSOtm added enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM labels Dec 18, 2024
@Rangi42
Copy link
Contributor

Rangi42 commented Dec 18, 2024

There are definitely some macros which just take a "flag" argument whose actual value doesn't matter (often it's 1, could be TRUE if the codebase uses such a constant, but 0 or foobar or whatever would also work) and just influences behavior of a _NARG check. So if we have a warning like this, there should be a convenient way to disable the warning, i.e. one that could be done in the definition of the macro, not at every usage site.

Syntax "to specify how many arguments they want to be given" sounds like it would develop into #912.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement Typically new features; lesser priority than bugs rgbasm This affects RGBASM
Projects
None yet
Development

No branches or pull requests

2 participants