I am working on a legacy C code base which includes a mix of old (K&R) style and new (ANSI) style definitions. The plan is to gradually remove all the old style definitions and replace them with new style. To help in progressing this plan, I'd like to make the compiler issue a diagnostic (warning or error) whenever an old style definition is encountered.
Using GCC, I can do this with the -Wold-style-definition
option, to generate a warning whenever an old/K&R style declaration is encountered. I can also have it generate an error, using either -Werror
or -Werror=old-style-definition
.
However, using clang, -Wold-style-definition
doesn't appear to do anything. Indeed, the Clang documentation states "This diagnostic flag exists for GCC compatibility, and has no effect in Clang."
So is there any other way to get clang to issue a diagnostic when an old style definition is encountered?