Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1555423 > unrolled thread
| Started by | Johannes Berg <johannes@sipsolutions.net> |
|---|---|
| First post | 2017-01-10 15:10 +0100 |
| Last post | 2017-01-10 18:00 +0100 |
| Articles | 6 — 2 participants |
Back to article view | Back to linux.kernel
[PATCH] checkpatch: don't warn on every struct without const_structs file Johannes Berg <johannes@sipsolutions.net> - 2017-01-10 15:10 +0100
Re: [PATCH] checkpatch: don't warn on every struct without const_structs file Joe Perches <joe@perches.com> - 2017-01-10 16:10 +0100
Re: [PATCH] checkpatch: don't warn on every struct without const_structs file Johannes Berg <johannes@sipsolutions.net> - 2017-01-10 16:10 +0100
Re: [PATCH] checkpatch: don't warn on every struct without const_structs file Joe Perches <joe@perches.com> - 2017-01-10 17:30 +0100
Re: [PATCH] checkpatch: don't warn on every struct without const_structs file Johannes Berg <johannes@sipsolutions.net> - 2017-01-10 17:40 +0100
Re: [PATCH] checkpatch: don't warn on every struct without const_structs file Joe Perches <joe@perches.com> - 2017-01-10 18:00 +0100
| From | Johannes Berg <johannes@sipsolutions.net> |
|---|---|
| Date | 2017-01-10 15:10 +0100 |
| Subject | [PATCH] checkpatch: don't warn on every struct without const_structs file |
| Message-ID | <sY5hD-2jO-33@gated-at.bofh.it> |
From: Johannes Berg <johannes.berg@intel.com>
The script says that it won't warn:
"No structs that should be const will be found [...]"
but then that doesn't work and it warns on every single struct
instead, since the regular expression ends up empty. Fix that
by checking that it's not empty first.
Fixes: bf1fa1dae68e ("checkpatch: externalize the structs that should be const")
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
---
scripts/checkpatch.pl | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/scripts/checkpatch.pl b/scripts/checkpatch.pl
index a8368d1c4348..722a319acec5 100755
--- a/scripts/checkpatch.pl
+++ b/scripts/checkpatch.pl
@@ -6010,7 +6010,8 @@ sub process {
}
# check for various structs that are normally const (ops, kgdb, device_tree)
- if ($line !~ /\bconst\b/ &&
+ if ($const_structs ne "" &&
+ $line !~ /\bconst\b/ &&
$line =~ /\bstruct\s+($const_structs)\b/) {
WARN("CONST_STRUCT",
"struct $1 should normally be const\n" .
--
2.9.3
[toc] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-01-10 16:10 +0100 |
| Subject | Re: [PATCH] checkpatch: don't warn on every struct without const_structs file |
| Message-ID | <sY6dI-2W2-61@gated-at.bofh.it> |
| In reply to | #1555423 |
On Tue, 2017-01-10 at 15:03 +0100, Johannes Berg wrote: > From: Johannes Berg <johannes.berg@intel.com> > > The script says that it won't warn: > "No structs that should be const will be found [...]" > > but then that doesn't work and it warns on every single struct > instead, since the regular expression ends up empty. Fix that > by checking that it's not empty first. nak. How does const_structs end up empty for you?
[toc] | [prev] | [next] | [standalone]
| From | Johannes Berg <johannes@sipsolutions.net> |
|---|---|
| Date | 2017-01-10 16:10 +0100 |
| Subject | Re: [PATCH] checkpatch: don't warn on every struct without const_structs file |
| Message-ID | <sY6dI-2W2-63@gated-at.bofh.it> |
| In reply to | #1555568 |
On Tue, 2017-01-10 at 07:01 -0800, Joe Perches wrote: > On Tue, 2017-01-10 at 15:03 +0100, Johannes Berg wrote: > > From: Johannes Berg <johannes.berg@intel.com> > > > > The script says that it won't warn: > > "No structs that should be const will be found [...]" > > > > but then that doesn't work and it warns on every single struct > > instead, since the regular expression ends up empty. Fix that > > by checking that it's not empty first. > > nak. > > How does const_structs end up empty for you? I copied checkpatch elsewhere and ran it. Regardless, the current code is utterly stupid - it prints a warning that it won't flag any structs, and then proceeds to flag all structs. If you must, send a patch to abort() [whatever the perl equivalent is] when the file can't be found, but as it is, the code is just idiotic. johannes
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-01-10 17:30 +0100 |
| Subject | Re: [PATCH] checkpatch: don't warn on every struct without const_structs file |
| Message-ID | <sY7t9-3Cj-35@gated-at.bofh.it> |
| In reply to | #1555569 |
On Tue, 2017-01-10 at 16:04 +0100, Johannes Berg wrote: > On Tue, 2017-01-10 at 07:01 -0800, Joe Perches wrote: > > On Tue, 2017-01-10 at 15:03 +0100, Johannes Berg wrote: > > > From: Johannes Berg <johannes.berg@intel.com> > > > > > > The script says that it won't warn: > > > "No structs that should be const will be found [...]" > > > > > > but then that doesn't work and it warns on every single struct > > > instead, since the regular expression ends up empty. Fix that > > > by checking that it's not empty first. > > > > nak. > > > > How does const_structs end up empty for you? > > I copied checkpatch elsewhere and ran it. Why do you want to copy checkpatch "someplace else"? Instead of copy, I think you should soft link it. > Regardless, the current code is utterly stupid - it prints a warning > that it won't flag any structs, and then proceeds to flag all structs. > > If you must, send a patch to abort() [whatever the perl equivalent is] > when the file can't be found, but as it is, the code is just idiotic. Maybe so. As is, your patch description is incomplete because it doesn't mention your use case.
[toc] | [prev] | [next] | [standalone]
| From | Johannes Berg <johannes@sipsolutions.net> |
|---|---|
| Date | 2017-01-10 17:40 +0100 |
| Subject | Re: [PATCH] checkpatch: don't warn on every struct without const_structs file |
| Message-ID | <sY7CP-3Fl-43@gated-at.bofh.it> |
| In reply to | #1555674 |
> > I copied checkpatch elsewhere and ran it. > > Why do you want to copy checkpatch "someplace else"? > Instead of copy, I think you should soft link it. Well, no, I have to distribute it with that. > > Regardless, the current code is utterly stupid - it prints a > > warning that it won't flag any structs, and then proceeds to flag > > all structs. > > > > If you must, send a patch to abort() [whatever the perl equivalent > > is] when the file can't be found, but as it is, the code is just > > idiotic. > > Maybe so. > > As is, your patch description is incomplete because > it doesn't mention your use case. I don't think that's relevant. The script is internally inconsistent, as I do mention in the commit log, which is worth fixing. johannes
[toc] | [prev] | [next] | [standalone]
| From | Joe Perches <joe@perches.com> |
|---|---|
| Date | 2017-01-10 18:00 +0100 |
| Subject | Re: [PATCH] checkpatch: don't warn on every struct without const_structs file |
| Message-ID | <sY7Wa-3M3-33@gated-at.bofh.it> |
| In reply to | #1555688 |
On Tue, 2017-01-10 at 17:31 +0100, Johannes Berg wrote: > > > I copied checkpatch elsewhere and ran it. > > > > Why do you want to copy checkpatch "someplace else"? > > Instead of copy, I think you should soft link it. > > Well, no, I have to distribute it with that. > > > > Regardless, the current code is utterly stupid - it prints a > > > warning that it won't flag any structs, and then proceeds to flag > > > all structs. > > > > > > If you must, send a patch to abort() [whatever the perl equivalent > > > is] when the file can't be found, but as it is, the code is just > > > idiotic. > > > > Maybe so. > > > > As is, your patch description is incomplete because > > it doesn't mention your use case. > > I don't think that's relevant. I do. checkpatch is a script written for linux patches. You are making use of the script outside of the linux tree. You could just as well keep a local copy of this patch instead. Your patch allows you to avoid this and the patch description is relevant to why this is useful. So your patch description is simply incorrect/incomplete: --------------------------------------------------------------- The script says that it won't warn: "No structs that should be const will be found [...]" but then that doesn't work and it warns on every single struct instead, since the regular expression ends up empty. Fix that by checking that it's not empty first. --------------------------------------------------------------- When used for linux, checkpatch works just fine and your patch description describes a condition that doesn't happen. > The script is internally inconsistent, > as I do mention in the commit log, which is worth fixing. Yeah, I think it's useful to fix. Just make the commit message describe why the patch is appropriate for non-linux uses.
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web