Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751464AbdIJPqk (ORCPT ); Sun, 10 Sep 2017 11:46:40 -0400 Received: from mout.gmx.net ([212.227.17.21]:58491 "EHLO mout.gmx.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750943AbdIJPqj (ORCPT ); Sun, 10 Sep 2017 11:46:39 -0400 From: Heinrich Schuchardt To: Joe Perches Cc: Andy Whitcroft , linux-kernel@vger.kernel.org, Heinrich Schuchardt Subject: [PATCH v2 1/1] scripts/checkpatch.pl: avoid false warning missing break Date: Sun, 10 Sep 2017 17:46:18 +0200 Message-Id: <20170910154618.25819-1-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.11.0 In-Reply-To: <1505052969.22023.1.camel@perches.com> References: <1505052969.22023.1.camel@perches.com> X-Provags-ID: V03:K0:OGJxpTOxzlYhLRvd3/v/u83WHc7G7V1rVzY+kn9aKW49OYtGvUD yiCpwC1MrqptdHX/guL8LT6Hd63NkdSmf+S4cmZiwxJdZQ/7j2m7Fm24l0YQRWgTM7rCnR0 yh7iJ6if1yBut5J3ynx71ew6Ug/UqKpV8oLmDeTy9WIUU7JsHMN35YehxrKQnL5GTkjaBGJ xNUVJubH8vjJvCjllgpyg== X-UI-Out-Filterresults: notjunk:1;V01:K0:9OAiT1TPbcE=:EtumtONSlgWfOeefjPUWT2 jrLt8j1CGJdk7q5n3/1SrmkvzKkJbzHhKzWZ+Nkr+lTfy1/6S1w5aDF2nNHWSE5nAVfHAiby8 VF9PJ4crPJy19oJmJrpKodjKlTd5af7NFD7IABHmaYiDTIq7yPNImFWIO4OViLzW3wQCmUljo guWyVT/3Ju4mca2aBxZN+15uepsvVR3xTsUNPzp9dU3Zal7oFI8DcW8OebOxrV3TFBYQfDQ8j dudsc8DkiCgdf1wFRs5WiRa8c3IrtsXV78uDaDhxMRtYyX5TqxR4ju9WWsDXDFp4Nttb3x+n5 0N6YKvApJ6Rsx1mHonlMNiE3TxifOZnsX/HFKNJiqACTXYs43yW7UR64eiF7wi9NfOBWChsKE 23fhKuwKQtafvVk2f/OmaTqsjidsmE3Yet1dS5KybW81XMDYsjDIagLT/JKLvmHF0oXOOBywa MvwBavjOpDzRbsbzRPPSlBQJ4mgI7MtZEmnwY4xvM9B9AuzcBh6WRfjwA6s2hYDKpukz/tbSt uImo/OohrZmy0N6j/tlxz5dM1SVA7VQ9IA339O7Veren4j5FGeizbJZy7fGndKOhyPSzyglld 2NM6i1grW0MWcK/Ty/6vtPbxaN0CrNw12gFgiMkeznHCZs4thqt8mk9FRju1JZscsjzJ01Nky 8KKJBoBLPO2VT2iQNR+2kT6VKpiC5q68ImgsOfbeKMEfYOsD6kb1veNH4kCCVNZhjU0LRzEza hhq2wVYE+ySO+I9VcD7dePLCgpGmikfEsOHE9bHXl3wpOFV/I8Uex3XMJWAEgzYOZKjMKi/9e qTqhlopos9pxRsSPiKXEMoTRZzxXA== Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 957 Lines: 37 void foo(int a) switch (a) { case 'h': fun1(); exit(1); default: } creates a warning Possible switch case/default not preceded by break or fallthrough comment exit( should be treated like return. Signed-off-by: Heinrich Schuchardt --- v2: Allow whitespace between 'exit' and '('. --- scripts/checkpatch.pl | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl index 2287a0bca8..690fe07d1b 100755 --- a/scripts/checkpatch.pl +++ b/scripts/checkpatch.pl @@ -6084,7 +6084,7 @@ sub process { next if ($fline =~ /^.[\s$;]*$/); $has_statement = 1; $count++; - $has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|return\b|goto\b|continue\b)/); + $has_break = 1 if ($fline =~ /\bswitch\b|\b(?:break\s*;[\s$;]*$|exit\s*\(\b|return\b|goto\b|continue\b)/); } if (!$has_break && $has_statement) { WARN("MISSING_BREAK", -- 2.11.0