* [merged] checkpatch-update-__attribute__sectionname-quote-removal.patch removed from -mm tree
@ 2020-12-16 17:10 akpm
0 siblings, 0 replies; only message in thread
From: akpm @ 2020-12-16 17:10 UTC (permalink / raw)
To: dwaipayanray1, joe, mm-commits
The patch titled
Subject: checkpatch: update __attribute__((section("name"))) quote removal
has been removed from the -mm tree. Its filename was
checkpatch-update-__attribute__sectionname-quote-removal.patch
This patch was dropped because it was merged into mainline or a subsystem tree
------------------------------------------------------
From: Joe Perches <joe@perches.com>
Subject: checkpatch: update __attribute__((section("name"))) quote removal
commit 33def8498fdd ("treewide: Convert macro and uses of
__section(foo) to __section("foo")") removed the stringification of the
section name and now requires quotes around the named section.
Update checkpatch to not remove any quotes when suggesting conversion
of __attribute__((section("name"))) to __section("name")
Miscellanea:
o Add section to the hash with __section replacement
o Remove separate test for __attribute__((section
o Remove the limitation on converting attributes containing only
known, possible conversions. Any unknown attribute types are now
left as-is and known types are converted and moved before
__attribute__ and removed from within the __attribute__((list...)).
[joe@perches.com: eliminate the separate test below the possible conversions loop]
Link: https://lkml.kernel.org/r/58e9d55e933dc8fdc6af489f2ad797fa8eb13e44.camel@perches.com
Link: https://lkml.kernel.org/r/c04dd1c810e8d6a68e6a632e3191ae91651c8edf.camel@perches.com
Signed-off-by: Joe Perches <joe@perches.com>
Cc: Dwaipayan Ray <dwaipayanray1@gmail.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
---
scripts/checkpatch.pl | 47 ++++++++++++----------------------------
1 file changed, 15 insertions(+), 32 deletions(-)
--- a/scripts/checkpatch.pl~checkpatch-update-__attribute__sectionname-quote-removal
+++ a/scripts/checkpatch.pl
@@ -6216,50 +6216,33 @@ sub process {
"noreturn" => "__noreturn",
"packed" => "__packed",
"pure" => "__pure",
+ "section" => "__section",
"used" => "__used"
);
- my @conv_array = ();
- my $conv_possible = 1;
-
while ($attr =~ /\s*(\w+)\s*(${balanced_parens})?/g) {
- my $curr_attr = $1;
+ my $orig_attr = $1;
my $params = '';
$params = $2 if defined($2);
+ my $curr_attr = $orig_attr;
$curr_attr =~ s/^[\s_]+|[\s_]+$//g;
-
if (exists($attr_list{$curr_attr})) {
+ my $new = $attr_list{$curr_attr};
if ($curr_attr eq "format" && $params) {
$params =~ /^\s*\(\s*(\w+)\s*,\s*(.*)/;
- push(@conv_array, "__$1\($2");
+ $new = "__$1\($2";
} else {
- my $new = $attr_list{$curr_attr};
- push(@conv_array, "$new$params");
+ $new = "$new$params";
+ }
+ if (WARN("PREFER_DEFINED_ATTRIBUTE_MACRO",
+ "Prefer $new over __attribute__(($orig_attr$params))\n" . $herecurr) &&
+ $fix) {
+ my $remove = "\Q$orig_attr\E" . '\s*' . "\Q$params\E" . '(?:\s*,\s*)?';
+ $fixed[$fixlinenr] =~ s/$remove//;
+ $fixed[$fixlinenr] =~ s/\b__attribute__/$new __attribute__/;
+ $fixed[$fixlinenr] =~ s/\}\Q$new\E/} $new/;
+ $fixed[$fixlinenr] =~ s/ __attribute__\s*\(\s*\(\s*\)\s*\)//;
}
- } else {
- $conv_possible = 0;
- last;
- }
- }
-
- if (scalar @conv_array > 0 && $conv_possible == 1) {
- my $replace = join(' ', @conv_array);
- if (WARN("PREFER_DEFINED_ATTRIBUTE_MACRO",
- "$replace is preferred over __attribute__(($attr))\n" . $herecurr) &&
- $fix) {
- $fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*\Q$attr\E\s*\)\s*\)/$replace/;
- $fixed[$fixlinenr] =~ s/\}\Q$replace\E/} $replace/;
- }
- }
-
- # Check for __attribute__ section, prefer __section
- if ($attr =~ /^_*section_*\s*\(\s*("[^"]*")/) {
- my $old = substr($attr, $-[1], $+[1] - $-[1]);
- my $new = substr($old, 1, -1);
- if (WARN("PREFER_DEFINED_ATTRIBUTE_MACRO",
- "__section($new) is preferred over __attribute__((section($old)))\n" . $herecurr) &&
- $fix) {
- $fixed[$fixlinenr] =~ s/\b__attribute__\s*\(\s*\(\s*_*section_*\s*\(\s*\Q$old\E\s*\)\s*\)\s*\)/__section($new)/;
}
}
_
Patches currently in -mm which might be from joe@perches.com are
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-12-16 17:10 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-16 17:10 [merged] checkpatch-update-__attribute__sectionname-quote-removal.patch removed from -mm tree akpm
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).