-Wformat-sign-mismatch?

Dan Kegel dkegel@ixiacom.com
Mon Feb 10 21:32:00 GMT 2003


Joseph S. Myers wrote:
> On Mon, 10 Feb 2003, Dan Kegel wrote:
> 
> 
>>At our company, Gimpel's PC-Lint flagged an warning
>>in code similar to this:
>>         unsigned long iResult;
>>         sscanf(s, "%ld", &iResult);
>>
>>Do we want gcc to detect such mismatches, too?
>>I don't think it could as of the gcc 3.2 I tried.
> 
> 
> Use -Wformat -pedantic to detect such mismatches.

Thanks very much.  I did read the manual, but it didn't
hint that -pedantic would turn on this kind of -Wformat check.
Would it be appropriate to spell this out more clearly?  e.g.

--- invoke.texi.old     Mon Feb 10 13:21:32 2003
+++ invoke.texi Mon Feb 10 13:23:18 2003
@@ -2034,6 +2034,8 @@
  @option{-Wno-format-extra-args}, @option{-Wno-format-zero-length},
  @option{-Wformat-nonliteral}, @option{-Wformat-security}, and
  @option{-Wformat=2} are available, but are not included in @option{-Wall}.
+Also, @option{-Wformat} @option{-pedantic} will check for more
+format mismatches, e.g. sign mismatches.

  @item -Wno-format-y2k
  @opindex Wno-format-y2k

- Dan





More information about the Gcc mailing list