[cfe-commits] [Patch] Add -Wmissing-variable-declarations
Ed Schouten
ed at 80386.nl
Tue Jul 24 07:06:59 PDT 2012
Hi Eli,
2012/6/21 Eli Friedman <eli.friedman at gmail.com>:
> Ah... looks like we don't call it for tentative definitions (which we
> handle in Sema::ActOnEndOfTranslationUnit). This has no effect for
> the existing checks in CheckCompleteVariableDeclaration because none
> of them apply to global variables in C. That could easily be changed,
> though.
Gotcha! Thanks for the pointer.
> Actually, you might want some special handling for tentative
> definitions. What do you expect the warning to do for a testcase like
> "int x; int x = 10;"?
Well, effectively I want to do the same as C++: int x must always be
preceded by extern int i, which is typically placed in a header file.
> I think it just got renamed to getPreviousDecl().
Got it.
I've updated the patch. As usual, it can be downloaded from:
http://80386.nl/pub/wmissing-variable-declarations.txt
--
Ed Schouten <ed at 80386.nl>
More information about the cfe-commits
mailing list