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

Remove unused #define #257

Open
laurentlb opened this issue Mar 20, 2023 · 4 comments
Open

Remove unused #define #257

laurentlb opened this issue Mar 20, 2023 · 4 comments

Comments

@laurentlb
Copy link
Owner

If there's a #define in a file, but the macro is not used anywhere, we should delete it.

With the preprocessor, this will become common:

#define PRETTIER 1

#ifdef PRETTIER
...
#endif

The preprocessor can evaluate and remove the #ifdef line, but it doesn't know if the macro should be preserved or not.

@eldritchconundrum
Copy link
Collaborator

Gotta implement actual replacement of tokens in the code... Then the #define can always be deleted.

@laurentlb
Copy link
Owner Author

We don't want to remove all defines, just the ones that are not used.

@eldritchconundrum
Copy link
Collaborator

Evaluating and removing defines could yield a smaller output.

@laurentlb
Copy link
Owner Author

Or in many cases, larger...

In any case, inlining the defines is an independent feature request.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants