* [PATCH RESEND] scripts: headers_install: fix a false positive
@ 2025-06-29 15:52 Wen Yang
2025-06-30 12:48 ` Masahiro Yamada
0 siblings, 1 reply; 2+ messages in thread
From: Wen Yang @ 2025-06-29 15:52 UTC (permalink / raw)
To: Masahiro Yamada, ndrew Morton
Cc: Nicolas Schier, Miguel Ojeda, linux-kernel, Wen Yang
The current implementation only handles C89 style comments (/*... */) in
the code, and there are false positives for C99 style comments (//...).
This patch fixes this issue.
Signed-off-by: Wen Yang <wen.yang@linux.dev>
---
| 1 +
1 file changed, 1 insertion(+)
--git a/scripts/headers_install.sh b/scripts/headers_install.sh
index 6bbccb43f7e7..41722bcc8668 100755
--- a/scripts/headers_install.sh
+++ b/scripts/headers_install.sh
@@ -44,6 +44,7 @@ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
# Remove /* ... */ style comments, and find CONFIG_ references in code
configs=$(sed -e '
:comment
+ s://.*::
s:/\*[^*][^*]*:/*:
s:/\*\*\**\([^/]\):/*\1:
t comment
--
2.25.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH RESEND] scripts: headers_install: fix a false positive
2025-06-29 15:52 [PATCH RESEND] scripts: headers_install: fix a false positive Wen Yang
@ 2025-06-30 12:48 ` Masahiro Yamada
0 siblings, 0 replies; 2+ messages in thread
From: Masahiro Yamada @ 2025-06-30 12:48 UTC (permalink / raw)
To: Wen Yang; +Cc: ndrew Morton, Nicolas Schier, Miguel Ojeda, linux-kernel
On Mon, Jun 30, 2025 at 12:52 AM Wen Yang <wen.yang@linux.dev> wrote:
>
> The current implementation only handles C89 style comments (/*... */) in
> the code, and there are false positives for C99 style comments (//...).
>
> This patch fixes this issue.
>
> Signed-off-by: Wen Yang <wen.yang@linux.dev>
> ---
> scripts/headers_install.sh | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/scripts/headers_install.sh b/scripts/headers_install.sh
> index 6bbccb43f7e7..41722bcc8668 100755
> --- a/scripts/headers_install.sh
> +++ b/scripts/headers_install.sh
> @@ -44,6 +44,7 @@ scripts/unifdef -U__KERNEL__ -D__EXPORTED_HEADERS__ $TMPFILE > $OUTFILE
> # Remove /* ... */ style comments, and find CONFIG_ references in code
> configs=$(sed -e '
> :comment
> + s://.*::
This is wrong.
For example, apply the following patch.
CONFIG_FOO is outside the comment line,
but it does not detect it.
diff --git a/include/uapi/linux/kernel.h b/include/uapi/linux/kernel.h
index fadf2db71fe8..b6d50805718e 100644
--- a/include/uapi/linux/kernel.h
+++ b/include/uapi/linux/kernel.h
@@ -5,4 +5,7 @@
#include <linux/sysinfo.h>
#include <linux/const.h>
+/* // */
+#define FOO CONFIG_FOO
+
#endif /* _UAPI_LINUX_KERNEL_H */
> s:/\*[^*][^*]*:/*:
> s:/\*\*\**\([^/]\):/*\1:
> t comment
> --
> 2.25.1
>
--
Best Regards
Masahiro Yamada
^ permalink raw reply related [flat|nested] 2+ messages in thread
end of thread, other threads:[~2025-06-30 12:48 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-06-29 15:52 [PATCH RESEND] scripts: headers_install: fix a false positive Wen Yang
2025-06-30 12:48 ` Masahiro Yamada
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.