forked from mirrors/linux
		
	Based on 1 normalized pattern(s): gplv2 extracted by the scancode license scanner the SPDX license identifier GPL-2.0-only has been chosen to replace the boilerplate/reference in 58 file(s). Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Enrico Weigelt <info@metux.net> Reviewed-by: Allison Randal <allison@lohutok.net> Reviewed-by: Kate Stewart <kstewart@linuxfoundation.org> Cc: linux-spdx@vger.kernel.org Link: https://lkml.kernel.org/r/20190604081207.556988620@linutronix.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
		
			
				
	
	
		
			91 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
			
		
		
	
	
			91 lines
		
	
	
	
		
			1.5 KiB
		
	
	
	
		
			Text
		
	
	
	
	
	
// SPDX-License-Identifier: GPL-2.0-only
 | 
						|
/// Remove unneeded conversion to bool
 | 
						|
///
 | 
						|
//# Relational and logical operators evaluate to bool,
 | 
						|
//# explicit conversion is overly verbose and unneeded.
 | 
						|
//
 | 
						|
// Copyright: (C) 2016 Andrew F. Davis <afd@ti.com>
 | 
						|
 | 
						|
virtual patch
 | 
						|
virtual context
 | 
						|
virtual org
 | 
						|
virtual report
 | 
						|
 | 
						|
//----------------------------------------------------------
 | 
						|
//  For patch mode
 | 
						|
//----------------------------------------------------------
 | 
						|
 | 
						|
@depends on patch@
 | 
						|
expression A, B;
 | 
						|
symbol true, false;
 | 
						|
@@
 | 
						|
 | 
						|
(
 | 
						|
  A == B
 | 
						|
|
 | 
						|
  A != B
 | 
						|
|
 | 
						|
  A > B
 | 
						|
|
 | 
						|
  A < B
 | 
						|
|
 | 
						|
  A >= B
 | 
						|
|
 | 
						|
  A <= B
 | 
						|
|
 | 
						|
  A && B
 | 
						|
|
 | 
						|
  A || B
 | 
						|
)
 | 
						|
- ? true : false
 | 
						|
 | 
						|
//----------------------------------------------------------
 | 
						|
//  For context mode
 | 
						|
//----------------------------------------------------------
 | 
						|
 | 
						|
@r depends on !patch@
 | 
						|
expression A, B;
 | 
						|
symbol true, false;
 | 
						|
position p;
 | 
						|
@@
 | 
						|
 | 
						|
(
 | 
						|
  A == B
 | 
						|
|
 | 
						|
  A != B
 | 
						|
|
 | 
						|
  A > B
 | 
						|
|
 | 
						|
  A < B
 | 
						|
|
 | 
						|
  A >= B
 | 
						|
|
 | 
						|
  A <= B
 | 
						|
|
 | 
						|
  A && B
 | 
						|
|
 | 
						|
  A || B
 | 
						|
)
 | 
						|
* ? true : false@p
 | 
						|
 | 
						|
//----------------------------------------------------------
 | 
						|
//  For org mode
 | 
						|
//----------------------------------------------------------
 | 
						|
 | 
						|
@script:python depends on r&&org@
 | 
						|
p << r.p;
 | 
						|
@@
 | 
						|
 | 
						|
msg = "WARNING: conversion to bool not needed here"
 | 
						|
coccilib.org.print_todo(p[0], msg)
 | 
						|
 | 
						|
//----------------------------------------------------------
 | 
						|
//  For report mode
 | 
						|
//----------------------------------------------------------
 | 
						|
 | 
						|
@script:python depends on r&&report@
 | 
						|
p << r.p;
 | 
						|
@@
 | 
						|
 | 
						|
msg = "WARNING: conversion to bool not needed here"
 | 
						|
coccilib.report.print_report(p[0], msg)
 |