From: Florian Weimer <fweimer@redhat.com>
To: Andreas Schwab <schwab@linux-m68k.org>
Cc: Florian Weimer via Libc-alpha <libc-alpha@sourceware.org>
Subject: Re: [PATCH v4 2/3] Linux: Implement a useful version of _startup_fatal
Date: Thu, 05 May 2022 17:43:15 +0200 [thread overview]
Message-ID: <87bkwcm1d8.fsf@oldenburg.str.redhat.com> (raw)
In-Reply-To: <87ilqk6ltk.fsf@igel.home> (Andreas Schwab's message of "Thu, 05 May 2022 17:28:07 +0200")
* Andreas Schwab:
> On Mai 05 2022, Florian Weimer via Libc-alpha wrote:
>
>> +/* Avoid a run-time invocation of strlen. */
>> +#define _startup_fatal(message) \
>> + do \
>> + { \
>> + size_t __message_length = __builtin_strlen (message); \
>> + if (! __builtin_constant_p (__message_length)) \
>> + { \
>> + extern void _startup_fatal_not_constant (void); \
>> + _startup_fatal_not_constant (); \
>> + } \
>
> I think that could use _Static_assert.
It only works for simple cases, not for arguments that require constant
progagation:
libc-tls.c: In function ‘__libc_setup_tls’:
../sysdeps/unix/sysv/linux/startup.h:29:23: error: expression in static assertion is not constant
29 | _Static_assert (__builtin_constant_p (__message_length), \
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Thanks,
Florian
next prev parent reply other threads:[~2022-05-05 15:43 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-05 15:06 [PATCH v4 1/3] ia64: Always define IA64_USE_NEW_STUB as a flag macro Florian Weimer
2022-05-05 15:07 ` [PATCH v4 2/3] Linux: Implement a useful version of _startup_fatal Florian Weimer
2022-05-05 15:28 ` Andreas Schwab
2022-05-05 15:43 ` Florian Weimer [this message]
2022-05-05 17:29 ` Adhemerval Zanella
2022-05-05 15:08 ` [PATCH v4 3/3] csu: Implement and use _dl_early_allocate during static startup Florian Weimer
2022-05-05 17:48 ` Adhemerval Zanella
2022-05-05 18:03 ` Florian Weimer
2022-05-05 18:25 ` Adhemerval Zanella
2022-05-06 10:00 ` Florian Weimer
2022-05-06 13:04 ` Adhemerval Zanella
2022-05-06 13:19 ` Adhemerval Zanella
2022-05-09 16:10 ` Florian Weimer
2022-05-09 16:52 ` Adhemerval Zanella
2022-05-09 17:08 ` Florian Weimer
2022-05-09 17:37 ` Adhemerval Zanella
2022-05-05 17:28 ` [PATCH v4 1/3] ia64: Always define IA64_USE_NEW_STUB as a flag macro Adhemerval Zanella
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=87bkwcm1d8.fsf@oldenburg.str.redhat.com \
--to=fweimer@redhat.com \
--cc=libc-alpha@sourceware.org \
--cc=schwab@linux-m68k.org \
/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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).