[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <50dc2d72-79be-45cc-add9-82c76099cfe1@app.fastmail.com>
Date: Fri, 27 Jun 2025 07:58:58 +0200
From: "Arnd Bergmann" <arnd@...db.de>
To: "Willy Tarreau" <w@....eu>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
Thomas Weißschuh <thomas.weissschuh@...utronix.de>,
linux-kernel@...r.kernel.org, "Masahiro Yamada" <masahiroy@...nel.org>
Subject: Re: [RFC PATCH 3/3] tools/nolibc: add a new "install_all_archs" target
On Fri, Jun 27, 2025, at 05:25, Willy Tarreau wrote:
> On Thu, Jun 26, 2025 at 11:15:07PM +0200, Arnd Bergmann wrote:
>> On Thu, Jun 26, 2025, at 22:18, Thomas Weißschuh wrote:
>> If it's indeed possible to concatenate the path name (I couldn't
>> figure that out either), that could also be done in place of the
>> symlink but simpler than the #if/#elif/#elif/... block, like
>>
>> #include <arch.h> // defines ARCH_PREFIX
>> #include CONCAT(ARCH_PREFIX, ioctl.h)
>
> I have never found how it would be possible to do that, let alone in a
> more or less portable way, because #include doesn't take a C-string in
> argument but a special syntax which is specific to it ("x" or <x>). It
> doesn't support concatenating strings for example:
>
> #include "stdio"".h"
>
> $ gcc -E inc.h
> inc.h:1:17: warning: extra tokens at end of #include directive
> 1 | #include "stdio"".h"
> | ^~~~
> inc.h:1:10: fatal error: stdio: No such file or directory
> 1 | #include "stdio"".h"
> | ^~~~~~~
This variant does seem to work with gcc and clang:
#define ARCH i386
#define __ARCH_HEADER(a, b) <a ## _ ## b>
#define _ARCH_HEADER(a, b) __ARCH_HEADER(a, b)
#include _ARCH_HEADER(ARCH, stdio.h)
Or even simpler
#define _NOLIBC_ARCH_HEADER(file) <i386_ ## file>
The ## concatenation is a bit limited here since cpp requires
both sides to expand to an identifier, meaning you can have
a '_' next to it, but not a '/' or '-'.
Arnd
Powered by blists - more mailing lists