Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 15 additions & 15 deletions scripts/checkpatch.pl
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env perl

Check warning on line 1 in scripts/checkpatch.pl

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

License may not be allowed

scripts/checkpatch.pl:1 License file for 'GPL-2.0' not found in /LICENSES. Please check https://docs.zephyrproject.org/latest/contribute/guidelines.html#components-using-other-licenses.

Check warning on line 1 in scripts/checkpatch.pl

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

Copyright missing

scripts/checkpatch.pl:1 File has no SPDX-FileCopyrightText header, consider adding one.

Check warning on line 1 in scripts/checkpatch.pl

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

License may not be allowed

scripts/checkpatch.pl:1 License file for 'GPL-2.0' not found in /LICENSES. Please check https://docs.zephyrproject.org/latest/contribute/guidelines.html#components-using-other-licenses.

Check warning on line 1 in scripts/checkpatch.pl

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

Copyright missing

scripts/checkpatch.pl:1 File has no SPDX-FileCopyrightText header, consider adding one.

Check warning on line 1 in scripts/checkpatch.pl

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

License may not be allowed

scripts/checkpatch.pl:1 License file for 'GPL-2.0' not found in /LICENSES. Please check https://docs.zephyrproject.org/latest/contribute/guidelines.html#components-using-other-licenses.

Check warning on line 1 in scripts/checkpatch.pl

View workflow job for this annotation

GitHub Actions / Run compliance checks on patch series (PR)

Copyright missing

scripts/checkpatch.pl:1 File has no SPDX-FileCopyrightText header, consider adding one.
# SPDX-License-Identifier: GPL-2.0
#
# (c) 2001, Dave Jones. (the file handling bit)
Expand Down Expand Up @@ -3521,39 +3521,39 @@
}

# check for missing blank lines after declarations
if ($sline =~ /^\+\s+\S/ && #Not at char 1
if (($sline =~ /^\+\s+\S/ || $sline =~ /^\s+\S/) && # Not at char 1
# actual declarations
($prevline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
($prevline =~ /^(\+|\s)\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# function pointer declarations
$prevline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
$prevline =~ /^(\+|\s)\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
# foo bar; where foo is some local typedef or #define
$prevline =~ /^\+\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
$prevline =~ /^(\+|\s)\s+$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
$prevline =~ /^\+\s+$declaration_macros/) &&
$prevline =~ /^(\+|\s)\s+$declaration_macros/) &&
# for "else if" which can look like "$Ident $Ident"
!($prevline =~ /^\+\s+$c90_Keywords\b/ ||
!($prevline =~ /^(\+|\s)\s+$c90_Keywords\b/ ||
# other possible extensions of declaration lines
$prevline =~ /(?:$Compare|$Assignment|$Operators)\s*$/ ||
# not starting a section or a macro "\" extended line
$prevline =~ /(?:\{\s*|\\)$/) &&
# looks like a declaration
!($sline =~ /^\+\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
!($sline =~ /^(\+|\s)\s+$Declare\s*$Ident\s*[=,;:\[]/ ||
# function pointer declarations
$sline =~ /^\+\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
$sline =~ /^(\+|\s)\s+$Declare\s*\(\s*\*\s*$Ident\s*\)\s*[=,;:\[\(]/ ||
# foo bar; where foo is some local typedef or #define
$sline =~ /^\+\s+(?:volatile\s+)?$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
$sline =~ /^(\+|\s)\s+(?:volatile\s+)?$Ident(?:\s+|\s*\*\s*)$Ident\s*[=,;\[]/ ||
# known declaration macros
$sline =~ /^\+\s+$declaration_macros/ ||
$sline =~ /^(\+|\s)\s+$declaration_macros/ ||
# start of struct or union or enum
$sline =~ /^\+\s+(?:volatile\s+)?(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
$sline =~ /^(\+|\s)\s+(?:volatile\s+)?(?:static\s+)?(?:const\s+)?(?:union|struct|enum|typedef)\b/ ||
# start or end of block or continuation of declaration
$sline =~ /^\+\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
$sline =~ /^(\+|\s)\s+(?:$|[\{\}\.\#\"\?\:\(\[])/ ||
# bitfield continuation
$sline =~ /^\+\s+$Ident\s*:\s*\d+\s*[,;]/ ||
$sline =~ /^(\+|\s)\s+$Ident\s*:\s*\d+\s*[,;]/ ||
# other possible extensions of declaration lines
$sline =~ /^\+\s+\(?\s*(?:$Compare|$Assignment|$Operators)/) &&
$sline =~ /^(\+|\s)\s+\(?\s*(?:$Compare|$Assignment|$Operators)/) &&
# indentation of previous and current line are the same
(($prevline =~ /\+(\s+)\S/) && $sline =~ /^\+$1\S/)) {
(($prevline =~ /^(\+|\s)(\s+)\S/) && $sline =~ /^(\+|\s)$2\S/)) {
if (WARN("LINE_SPACING",
"Missing a blank line after declarations\n" . $hereprev) &&
$fix) {
Expand Down
Loading