[cfe-dev] [clang][RFC] -Wmissing-prototypes: make suggested fix more generic?

Carlos Galvez via cfe-dev cfe-dev at lists.llvm.org
Fri Dec 10 05:25:10 PST 2021


Hi,

We want to enable the warning -Wmissing-prototypes to enforce internal
linkage as much as possible. It works great, with one caveat - it suggests
to use "static". Internal linkage can also be achieved with anonymous
namespaces and Clang will not issue a warning.

Now, the question as to what to use (static vs anonymous namespaces) is
mostly a style issue (a "Microscopic Detail" in the LLVM Coding
Guidelines). At our company we have decided to prefer anonymous namespaces
over static, so we wouldn't want Clang to start suggesting people
(especially junior devs that trust the tools blindly) to use static.

Therefore I wanted to ask here - would it be possible to make the
suggestion more generic, maybe displaying both alternatives? Best would be
making this user-configurable but I'm guessing that's not a trivial thing
to do.

I'm happy to implement the changes given some pointers, but I want to check
here first if you'd agree with it.

Thanks!
/Carlos
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20211210/c2c431f5/attachment.html>


More information about the cfe-dev mailing list