From: Stephen Hemminger <stephen@networkplumber.org>
To: "Morten Brørup" <mb@smartsharesystems.com>
Cc: <dev@dpdk.org>
Subject: Re: Function to fail at build time?
Date: Thu, 26 Jun 2025 07:31:31 -0700 [thread overview]
Message-ID: <20250626073131.1b4e3449@hermes.local> (raw)
In-Reply-To: <98CBD80474FA8B44BF855DF32C47DC35E9FD40@smartserver.smartshare.dk>
On Thu, 26 Jun 2025 01:55:02 +0200
Morten Brørup <mb@smartsharesystems.com> wrote:
> I was wondering if this was somehow possible:
>
> #define RTE_VERIFY(exp) do { \
> + if (__rte_constant(exp)) \
> + FAIL_AT_BUILD_TIME(); \
> if (unlikely(!(exp))) \
> rte_panic("line %d\tassert \"%s\" failed\n", __LINE__, #exp); \
> } while (0)
>
> I tried static_assert(), but it cannot be used in this way.
What happens?
next prev parent reply other threads:[~2025-06-26 14:31 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-06-25 23:55 Morten Brørup
2025-06-26 14:31 ` Stephen Hemminger [this message]
2025-06-26 15:23 ` Morten Brørup
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=20250626073131.1b4e3449@hermes.local \
--to=stephen@networkplumber.org \
--cc=dev@dpdk.org \
--cc=mb@smartsharesystems.com \
/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 NNTP newsgroup(s).