mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Arnd Bergmann" <arnd@arndb.de>
To: "Willy Tarreau" <w@1wt.eu>
Cc: "Thomas Weißschuh" <linux@weissschuh.net>,
	"Thomas Weißschuh" <thomas.weissschuh@linutronix.de>,
	linux-kernel@vger.kernel.org,
	"Masahiro Yamada" <masahiroy@kernel.org>
Subject: Re: [RFC PATCH 3/3] tools/nolibc: add a new "install_all_archs" target
Date: Fri, 27 Jun 2025 07:58:58 +0200	[thread overview]
Message-ID: <50dc2d72-79be-45cc-add9-82c76099cfe1@app.fastmail.com> (raw)
In-Reply-To: <20250627032551.GA4224@1wt.eu>

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

  reply	other threads:[~2025-06-27  5:59 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-06-20 10:37 [RFC PATCH 0/3] tools/nolibc: install unified multi-arch headers Willy Tarreau
2025-06-20 10:37 ` [RFC PATCH 1/3] tools/nolibc: merge i386 and x86_64 into a single x86 arch Willy Tarreau
2025-06-21  8:29   ` Thomas Weißschuh
2025-06-21  8:44     ` Willy Tarreau
2025-06-20 10:37 ` [RFC PATCH 2/3] tools/nolibc: add a new target "headers_all_archs" to loop over all archs Willy Tarreau
2025-06-23 21:56   ` Thomas Weißschuh
2025-06-24  6:20     ` Willy Tarreau
2025-06-24  7:46       ` Thomas Weißschuh
2025-06-24 10:00         ` Willy Tarreau
2025-06-20 10:37 ` [RFC PATCH 3/3] tools/nolibc: add a new "install_all_archs" target Willy Tarreau
2025-06-26 20:18   ` Thomas Weißschuh
2025-06-26 21:15     ` Arnd Bergmann
2025-06-27  3:25       ` Willy Tarreau
2025-06-27  5:58         ` Arnd Bergmann [this message]
2025-06-27  6:07           ` Willy Tarreau
2025-06-27  5:11       ` Thomas Weißschuh
2025-06-27  5:46         ` Willy Tarreau
2025-06-27  5:49           ` Willy Tarreau
2025-06-27  7:27             ` Thomas Weißschuh
2025-06-27  7:29               ` Willy Tarreau

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=50dc2d72-79be-45cc-add9-82c76099cfe1@app.fastmail.com \
    --to=arnd@arndb.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux@weissschuh.net \
    --cc=masahiroy@kernel.org \
    --cc=thomas.weissschuh@linutronix.de \
    --cc=w@1wt.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®