Re: [PATCH 1/2] radix tree test suite: include kconfig.h with incomplete path

From: Wei Yang
Date: Tue Jul 16 2024 - 20:34:45 EST


On Tue, Jul 16, 2024 at 11:54:47AM -0400, Liam R. Howlett wrote:
>* Wei Yang <richard.weiyang@xxxxxxxxx> [240716 03:56]:
>> On Tue, Jul 16, 2024 at 03:31:06AM +0100, Matthew Wilcox wrote:
>> >On Tue, Jul 16, 2024 at 02:15:43AM +0000, Wei Yang wrote:
>> >> If you think my understanding is correct, I would send a v2 with proper
>> >> changelog to describe it.
>> >
>> >It seems like you're trying to change something that isn't broken.
>>
>> Currently we don't find the problem because these two kconfig.h is similar.
>> The only difference is the one in tools/ doesn't include "generated/autoconf.h".
>
>We need that include.
>

I see your point, but I find current code has a chance not does do this.

>>
>> And in related files, like include/linux/xarray.h, includes the correct
>> kconfig.h.
>>
>> It is not broken, but doesn't mean it is correct, IMO.
>
>This is really annoying because it works today and your change was
>correct enough to look right, but it doesn't include the
>generated/autoconf.h - so it's not right. It took a lot of time to
>figure out that it isn't right.
>

I am not sure you have read my second mail.

Here is what I find.

I add a warning in tools/include/linux/kconfig.h.

diff --git a/tools/include/linux/kconfig.h b/tools/include/linux/kconfig.h
index 13b86bd3b746..12d3ed5f16b2 100644
--- a/tools/include/linux/kconfig.h
+++ b/tools/include/linux/kconfig.h
@@ -2,6 +2,8 @@
#ifndef _TOOLS_LINUX_KCONFIG_H
#define _TOOLS_LINUX_KCONFIG_H

+#warning include local kconfig.h
+

Then I run the command:

$make maple.o
cc -I. -I../../include -I../../../lib -g -Og -Wall -D_LGPL_SOURCE -fsanitize=address -fsanitize=undefined -c -o maple.o maple.c
In file included from ./linux/kernel.h:14,
from ../../include/linux/list.h:7,
from ./linux/../../../../include/linux/radix-tree.h:13,
from ./linux/radix-tree.h:5,
from test.h:4,
from maple.c:11:
./linux/../../../include/linux/kconfig.h:5:2: warning: #warning include local kconfig.h [-Wcpp]
5 | #warning include local kconfig.h
| ^~~~~~~

This means current code may include tools/include/linux/kconfig.h, which doesn't
include generated/autoconf.h.

After I change to <linux/kconfig.h> in kernel.h, the warning message is gone.

Current behavior is not what you expected, right? We have a chance to include
the kconfig.h which doesn't include generated/autoconf.h.

Hope not waste your time.

--
Wei Yang
Help you, Help me