17f904d7eSThomas Gleixner// SPDX-License-Identifier: GPL-2.0-only 27320bfa7SPeter Senna Tschudin/// 34341f6e5SFabio Estevam/// Remove unneeded semicolon. 47320bfa7SPeter Senna Tschudin/// 57320bfa7SPeter Senna Tschudin// Confidence: Moderate 67f904d7eSThomas Gleixner// Copyright: (C) 2012 Peter Senna Tschudin, INRIA/LIP6. 7*f01701ceSJulia Lawall// URL: https://coccinelle.gitlabpages.inria.fr/website 87320bfa7SPeter Senna Tschudin// Comments: Some false positives on empty default cases in switch statements. 97320bfa7SPeter Senna Tschudin// Options: --no-includes --include-headers 107320bfa7SPeter Senna Tschudin 117320bfa7SPeter Senna Tschudinvirtual patch 127320bfa7SPeter Senna Tschudinvirtual report 137320bfa7SPeter Senna Tschudinvirtual context 147320bfa7SPeter Senna Tschudinvirtual org 157320bfa7SPeter Senna Tschudin 167320bfa7SPeter Senna Tschudin@r_default@ 177320bfa7SPeter Senna Tschudinposition p; 187320bfa7SPeter Senna Tschudin@@ 197320bfa7SPeter Senna Tschudinswitch (...) 207320bfa7SPeter Senna Tschudin{ 217320bfa7SPeter Senna Tschudindefault: ...;@p 227320bfa7SPeter Senna Tschudin} 237320bfa7SPeter Senna Tschudin 247320bfa7SPeter Senna Tschudin@r_case@ 257320bfa7SPeter Senna Tschudinposition p; 267320bfa7SPeter Senna Tschudin@@ 277320bfa7SPeter Senna Tschudin( 287320bfa7SPeter Senna Tschudinswitch (...) 297320bfa7SPeter Senna Tschudin{ 307320bfa7SPeter Senna Tschudincase ...:;@p 317320bfa7SPeter Senna Tschudin} 327320bfa7SPeter Senna Tschudin| 337320bfa7SPeter Senna Tschudinswitch (...) 347320bfa7SPeter Senna Tschudin{ 357320bfa7SPeter Senna Tschudincase ...:... 367320bfa7SPeter Senna Tschudincase ...:;@p 377320bfa7SPeter Senna Tschudin} 387320bfa7SPeter Senna Tschudin| 397320bfa7SPeter Senna Tschudinswitch (...) 407320bfa7SPeter Senna Tschudin{ 417320bfa7SPeter Senna Tschudincase ...:... 427320bfa7SPeter Senna Tschudincase ...: 437320bfa7SPeter Senna Tschudincase ...:;@p 447320bfa7SPeter Senna Tschudin} 457320bfa7SPeter Senna Tschudin) 467320bfa7SPeter Senna Tschudin 477320bfa7SPeter Senna Tschudin@r1@ 487320bfa7SPeter Senna Tschudinstatement S; 497320bfa7SPeter Senna Tschudinposition p1; 507320bfa7SPeter Senna Tschudinposition p != {r_default.p, r_case.p}; 517320bfa7SPeter Senna Tschudinidentifier label; 527320bfa7SPeter Senna Tschudin@@ 537320bfa7SPeter Senna Tschudin( 547320bfa7SPeter Senna Tschudinlabel:; 557320bfa7SPeter Senna Tschudin| 567320bfa7SPeter Senna TschudinS@p1;@p 577320bfa7SPeter Senna Tschudin) 587320bfa7SPeter Senna Tschudin 597320bfa7SPeter Senna Tschudin@script:python@ 607320bfa7SPeter Senna Tschudinp << r1.p; 617320bfa7SPeter Senna Tschudinp1 << r1.p1; 627320bfa7SPeter Senna Tschudin@@ 637320bfa7SPeter Senna Tschudinif p[0].line != p1[0].line_end: 647320bfa7SPeter Senna Tschudin cocci.include_match(False) 657320bfa7SPeter Senna Tschudin 667320bfa7SPeter Senna Tschudin@depends on patch@ 677320bfa7SPeter Senna Tschudinposition r1.p; 687320bfa7SPeter Senna Tschudin@@ 697320bfa7SPeter Senna Tschudin-;@p 707320bfa7SPeter Senna Tschudin 717320bfa7SPeter Senna Tschudin@script:python depends on report@ 727320bfa7SPeter Senna Tschudinp << r1.p; 737320bfa7SPeter Senna Tschudin@@ 747320bfa7SPeter Senna Tschudincoccilib.report.print_report(p[0],"Unneeded semicolon") 757320bfa7SPeter Senna Tschudin 767320bfa7SPeter Senna Tschudin@depends on context@ 777320bfa7SPeter Senna Tschudinposition r1.p; 787320bfa7SPeter Senna Tschudin@@ 797320bfa7SPeter Senna Tschudin*;@p 807320bfa7SPeter Senna Tschudin 817320bfa7SPeter Senna Tschudin@script:python depends on org@ 827320bfa7SPeter Senna Tschudinp << r1.p; 837320bfa7SPeter Senna Tschudin@@ 847320bfa7SPeter Senna Tschudincocci.print_main("Unneeded semicolon",p) 85