* checkpatch query regarding .c and .h files..
@ 2019-06-02 17:02 Valdis Klētnieks
2019-06-02 18:04 ` Joe Perches
0 siblings, 1 reply; 2+ messages in thread
From: Valdis Klētnieks @ 2019-06-02 17:02 UTC (permalink / raw)
To: Rob Herring, Andy Whitcroft, Joe Perches; +Cc: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 971 bytes --]
scripts/checkpatch.pl contains this code near line 3070:
if ($realfile =~ /\.(h|s|S)$/) {
$comment = '/*';
} elsif ($realfile =~ /\.(c|dts|dtsi)$/) {
$comment = '//';
} elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc)$/) {
$comment = '#';
} elsif ($realfile =~ /\.rst$/) {
$comment = '..';
}
Was there a specific reason why .h files have /* */ and .c files have C89 // on
the SPDX comment line?
Would anybody like a patch that fixed checkpatch to allow either flavor on .c and .h files?
(I know I would, I just blew close to an hour trying to figure out why it whined about a
SPDX in a .h file I'm getting ready to upstream...)
[-- Attachment #2: Type: application/pgp-signature, Size: 832 bytes --]
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: checkpatch query regarding .c and .h files..
2019-06-02 17:02 checkpatch query regarding .c and .h files Valdis Klētnieks
@ 2019-06-02 18:04 ` Joe Perches
0 siblings, 0 replies; 2+ messages in thread
From: Joe Perches @ 2019-06-02 18:04 UTC (permalink / raw)
To: Valdis Klētnieks, Rob Herring, Andy Whitcroft
Cc: linux-kernel, Thomas Gleixner
On Sun, 2019-06-02 at 13:02 -0400, Valdis Klētnieks wrote:
> scripts/checkpatch.pl contains this code near line 3070:
>
> if ($realfile =~ /\.(h|s|S)$/) {
> $comment = '/*';
> } elsif ($realfile =~ /\.(c|dts|dtsi)$/) {
> $comment = '//';
> } elsif (($checklicenseline == 2) || $realfile =~ /\.(sh|pl|py|awk|tc)$/) {
> $comment = '#';
> } elsif ($realfile =~ /\.rst$/) {
> $comment = '..';
> }
>
> Was there a specific reason why .h files have /* */ and .c files have C89 // on
> the SPDX comment line?
>
> Would anybody like a patch that fixed checkpatch to allow either flavor on .c and .h files?
> (I know I would, I just blew close to an hour trying to figure out why it whined about a
> SPDX in a .h file I'm getting ready to upstream...)
It's described in Documentation/process/license-rules.rst
----------------------------------
2. Style:
The SPDX license identifier is added in form of a comment. The comment
style depends on the file type::
C source: // SPDX-License-Identifier: <SPDX License Expression>
C header: /* SPDX-License-Identifier: <SPDX License Expression> */
----------------------------------
It was because old versions of build tools could not handle
// in asm files.
It could be changed today because build tool version minimums
have been increased.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-06-02 18:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-06-02 17:02 checkpatch query regarding .c and .h files Valdis Klētnieks
2019-06-02 18:04 ` Joe Perches
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).