Re: [PATCH] void-cond: allow void in conditional expression

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 10/2/19 2:23 PM, Luc Van Oostenryck wrote:
> As an extension, allow conditional expressions (?:) with one
> side of type 'void' and consider the result to also be void.
> 
> The warning can be reinstated with the flag '-Wcond-void'.
> 
> Note: I only see a single occurrence of this in the kernel.

Yes, I would prefer to eliminate that one.  :)

> Suggested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

I prefer
Reported-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>
Tested-by: Randy Dunlap <rdunlap@xxxxxxxxxxxxx>

I didn't try to Suggest this.

One man page edit below...

> Suggested-by: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx>
> Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@xxxxxxxxx>
> ---
>  evaluate.c                   | 7 +++++++
>  lib.c                        | 2 ++
>  lib.h                        | 1 +
>  sparse.1                     | 7 +++++++
>  validation/cond-err-expand.c | 2 +-
>  5 files changed, 18 insertions(+), 1 deletion(-)


> diff --git a/sparse.1 b/sparse.1
> index beb484423..71ac0c646 100644
> --- a/sparse.1
> +++ b/sparse.1
> @@ -117,6 +117,13 @@ Sparse issues these warnings by default.  To turn them off, use
>  \fB\-Wno\-cast\-truncate\fR.
>  .
>  .TP
> +.B \-Wconditional\-void
> +Warn if one side of a conditional expression (\fB? :\fR) is of type
> +void and the other one not.
> +As an extension, Sparse consider the result of such expressions as also

                           considers

> +having the type void.
> +.
> +.TP
>  .B \-Wconstant\-suffix
>  Warn if an integer constant is larger than the maximum representable value
>  of the type indicated by its type suffix (if any). For example, on a


Thanks.
-- 
~Randy



[Index of Archives]     [Newbies FAQ]     [LKML]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Trinity Fuzzer Tool]

  Powered by Linux