This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: PATCH for Re: -Wformat-sign-mismatch?


On Sun, 16 Feb 2003, Gerald Pfeifer wrote:

> @@ -2026,6 +2026,10 @@ in the selected standard version (but no
>  since those are not in any version of the C standard).  @xref{C Dialect
>  Options,,Options Controlling C Dialect}.
> 
> +@option{-Wformat} will also warn about various pointer type mismatches
> +that the C standard does not permit for variadic functions, but which
> +most implementations (and the Single Unix Specification) permit.

I believe this should be part of the description of what -Wformat does
with -pedantic (and go before the cross-reference to the documentation of
-pedantic), and state that these mismatches count as features not
permitted by the standard ("This includes various ..." - possibly
"technical pointer type mismatches" since for many users some of them are
quite technical).

And perhaps it shouldn't be mentioned that SUS permits these variations; 
the wording allowing any pointer type to be interchanged with any other in 
va_arg is what allows it, but it has been pointed out that this wording is 
insufficient because it doesn't actually say what the conversion is when 
both types are pointer types that differ - it can't simply make it defined 
by saying "this is defined".  (The problem in drafts was that gaps in used 
scanf arguments were allowed with %1$ formats.  I proposed banning them 
(as with printf) but that was rejected so I proposed the fix in va_arg.  
That was accepted (rather than, as I'd hoped, making the reviewers realise 
that changing scanf might be better after all) but turned out to have the 
problem of not being sufficient to say how va_arg with mismatched types is 
defined; there was a discussion of this on the Austin Group mailing list 
a while back but I don't think it ever generated a defect report for the 
va_arg problems.)

-- 
Joseph S. Myers
jsm28@cam.ac.uk


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]