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

Add options from Weimer2018 especially errors for format-security and implicit-function-declaration #342

Open
david-a-wheeler opened this issue Dec 10, 2023 · 1 comment

Comments

@david-a-wheeler
Copy link
Contributor

david-a-wheeler commented Dec 10, 2023

Florian Weimer's 2018 article "Recommended compiler and linker flags for GCC" has a number of interesting ideas. We should review it for options.

At the very least, I like adding these options:

-Werror=format-security \
-Werror=implicit-function-declaration

As already noted in the guide, adding a general -Werror for all warnings has a lot of negatives, as it makes compilation very dependent on a specific version of a specific compiler. However, adding specific warnings for specific cases does not have this downside. We should probably do more of it.

In this case, these turn "should never do that" cases into outright errors. Raising an error for implicit function declaration is also part of #339. I worry that autoconf might have some implicit function declarations (at least for exit()) - we may need to determine how to deal with that and document it.

Possible other options, though I'm not as confident:

-fasynchronous-unwind-tables \
-fexceptions

Some discussion about implicit function breakage is here:
https://discourse.llvm.org/t/configure-script-breakage-with-the-new-werror-implicit-function-declaration/65213

@david-a-wheeler
Copy link
Contributor Author

Looks like the latest version of autoconf will address some of these. It's planned to be released next week (December 2023). A discussion about this should soon show here: https://lists.gnu.org/archive/html/autoconf/2023-12/threads.html

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

No branches or pull requests

1 participant