On Wed, Oct 17, 2012 at 11:16 AM, Matt Beaumont-Gay <[email protected]> wrote: > On Tue, Oct 16, 2012 at 11:53 AM, David Blaikie <[email protected]> wrote: >> Author: dblaikie >> Date: Tue Oct 16 13:53:14 2012 >> New Revision: 166039 >> >> URL: http://llvm.org/viewvc/llvm-project?rev=166039&view=rev >> Log: >> Implement GCC's -Wint-to-pointer-cast. >> >> This implementation doesn't warn on anything that GCC doesn't warn on with >> the >> exception of templates specializations (GCC doesn't warn, Clang does). The >> specific skipped cases (boolean, constant expressions, enums) are open for >> debate/adjustment if anyone wants to demonstrate that GCC is being overly >> conservative here. The only really obvious false positive I found was in the >> Clang regression suite's MPI test - apparently MPI uses specific flag values >> in >> pointer constants. (eg: #define FOO (void*)~0) >> >> Modified: >> cfe/trunk/include/clang/Basic/DiagnosticGroups.td >> cfe/trunk/include/clang/Basic/DiagnosticSemaKinds.td >> cfe/trunk/lib/Sema/SemaCast.cpp >> cfe/trunk/test/Analysis/CFContainers.mm >> cfe/trunk/test/Analysis/idempotent-operations.c >> cfe/trunk/test/Analysis/misc-ps-region-store.m >> cfe/trunk/test/Analysis/taint-tester.c >> cfe/trunk/test/CXX/dcl.dcl/dcl.spec/dcl.constexpr/p5.cpp >> cfe/trunk/test/Sema/block-return.c >> cfe/trunk/test/Sema/cast.c >> cfe/trunk/test/Sema/i-c-e.c >> cfe/trunk/test/SemaCXX/cast-conversion.cpp >> cfe/trunk/test/SemaCXX/decl-expr-ambiguity.cpp >> >> Modified: cfe/trunk/include/clang/Basic/DiagnosticGroups.td >> URL: >> http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Basic/DiagnosticGroups.td?rev=166039&r1=166038&r2=166039&view=diff >> ============================================================================== >> --- cfe/trunk/include/clang/Basic/DiagnosticGroups.td (original) >> +++ cfe/trunk/include/clang/Basic/DiagnosticGroups.td Tue Oct 16 13:53:14 >> 2012 >> @@ -365,6 +365,8 @@ >> >> def TypeSafety : DiagGroup<"type-safety">; >> >> +def IntToPointerCast : DiagGroup<"int-to-pointer-cast">; >> + >> def Extra : DiagGroup<"extra", [ >> MissingFieldInitializers, >> IgnoredQualifiers, >> @@ -412,7 +414,7 @@ >> // Note that putting warnings in -Wall will not disable them by default. If >> a >> // warning should be active _only_ when -Wall is passed in, mark it as >> // DefaultIgnore in addition to putting it here. >> -def : DiagGroup<"all", [Most, Parentheses, Switch]>; >> +def : DiagGroup<"all", [Most, Parentheses, Switch, IntToPointerCast]>; > > Any reason not to put the new flag in -Wmost?
It's on by default. The only reason it's in -Wall is because that's where it is in GCC. I suppose that doesn't rule out putting it in -Wmost instead, though - not sure what the tradeoffs/benefits are here. _______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
