This is the mail archive of the gcc-patches@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] Add -Womitted-conditional-op warning


On Fri, 2 Feb 2007, Andi Kleen wrote:

> I implemented a warning for this case. I guess it's relatively obscure, but will
> not hurt. The warning is enabled by default, but can be disabled with
> -Wno-omitted-conditional-op.

This extension seems like one that could be used in macros in system 
headers and so maybe the warning should be disabled by __extension__ (for 
C, see disable_extension_diagnostics / restore_extension_diagnostics).  
Or do you think that the particular cases you warn for are never going to 
arise from macros (given those could be replaced by ... ? 1 : ...)?

> +@item -Wno-omitted-conditional-op
> +@opindex Wno-omitted-conditional-op
> +Don't warn for dangerous uses of the 
> +?: with omitted middle operand GNU extension. When the condition
> +in the ?: operator is a computed boolean the omitted value will
> +be always 1. Often the user expects it to be a value computed
> +inside the conditional expression instead. Gcc by default warns 
> +for this, but this option disables it.

Two spaces after "." at end of sentence in Texinfo.  "GCC" not "Gcc".  Use 
@code or @samp around "?:".  Include a cross-reference to the section of 
the manual documenting this extension.

-- 
Joseph S. Myers
joseph@codesourcery.com


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