summaryrefslogtreecommitdiff
path: root/include/linux/compiler.h
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2024-08-01 10:43:15 -0700
committerJakub Kicinski <kuba@kernel.org>2024-08-01 10:45:23 -0700
commit5fa35bd39ce106889909444c937a10b2d3a79f08 (patch)
treebb1fde34b2c9907b1c4b69f6db992bbda0b02355 /include/linux/compiler.h
parent743ff02152bc46bb4a2f2a49ec891c87eba6ab5b (diff)
parent183d46ff422ef9f3d755b6808ef3faa6d009ba3a (diff)
downloadlwn-5fa35bd39ce106889909444c937a10b2d3a79f08.tar.gz
lwn-5fa35bd39ce106889909444c937a10b2d3a79f08.zip
Merge git://git.kernel.org/pub/scm/linux/kernel/git/netdev/net
Cross-merge networking fixes after downstream PR. No conflicts or adjacent changes. Link: https://patch.msgid.link/20240801131917.34494-1-pabeni@redhat.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'include/linux/compiler.h')
-rw-r--r--include/linux/compiler.h9
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/compiler.h b/include/linux/compiler.h
index 2594553bb30b..2df665fa2964 100644
--- a/include/linux/compiler.h
+++ b/include/linux/compiler.h
@@ -297,6 +297,15 @@ static inline void *offset_to_ptr(const int *off)
#define is_unsigned_type(type) (!is_signed_type(type))
/*
+ * Useful shorthand for "is this condition known at compile-time?"
+ *
+ * Note that the condition may involve non-constant values,
+ * but the compiler may know enough about the details of the
+ * values to determine that the condition is statically true.
+ */
+#define statically_true(x) (__builtin_constant_p(x) && (x))
+
+/*
* This is needed in functions which generate the stack canary, see
* arch/x86/kernel/smpboot.c::start_secondary() for an example.
*/