summaryrefslogtreecommitdiff
path: root/include/system/builtins_begin_.h
diff options
context:
space:
mode:
authorPeter Jones <pjones@redhat.com>2021-03-09 11:54:58 -0500
committerPeter Jones <pjones@redhat.com>2021-03-10 15:54:20 -0500
commit766aac4d5cfbe76026be5ce718b0883ee211f323 (patch)
tree56b15cac9a128b4285d58bc1e2a4b12cff5ed881 /include/system/builtins_begin_.h
parent78809820b5a3f79a0bfbec00e630e40011acf4ec (diff)
downloadefi-boot-shim-766aac4d5cfbe76026be5ce718b0883ee211f323.tar.gz
efi-boot-shim-766aac4d5cfbe76026be5ce718b0883ee211f323.zip
Consolidate most of our standard lib functions to lib
Signed-off-by: Peter Jones <pjones@redhat.com>
Diffstat (limited to 'include/system/builtins_begin_.h')
-rw-r--r--include/system/builtins_begin_.h94
1 files changed, 94 insertions, 0 deletions
diff --git a/include/system/builtins_begin_.h b/include/system/builtins_begin_.h
new file mode 100644
index 00000000..92ea5e3a
--- /dev/null
+++ b/include/system/builtins_begin_.h
@@ -0,0 +1,94 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+/**
+ * macros to build builtin wrappers
+ */
+#ifndef mkbi_cat_
+#define mkbi_cat_(a, b) a##b
+#endif
+#ifdef SHIM_STRING_C_
+
+#ifndef mkbi1_
+#define mkbi1_(rtype, x, typea, a) __typeof__(mkbi_cat_(__builtin_, x)) x;
+#endif
+#ifndef mkbi2_
+#define mkbi2_(rtype, x, typea, a, typeb, b) __typeof__(mkbi_cat_(__builtin_, x)) x;
+#endif
+
+#ifndef mkbi3_
+#define mkbi3_(rtype, x, typea, a, typeb, b, typec, c) __typeof__(mkbi_cat_(__builtin_, x)) x;
+#endif
+
+#ifndef mkdepbi1_
+#define mkdepbi1_(rtype, x, typea, a) __typeof__(mkbi_cat_(__builtin_, x)) x;
+#endif
+
+#ifndef mkdepbi2_
+#define mkdepbi2_(rtype, x, typea, a, typeb, b) __typeof__(mkbi_cat_(__builtin_, x)) x;
+#endif
+
+#else /* ! SHIM_STRING_C_ */
+
+#ifndef mkbi1_
+#define mkbi1_(rtype, x, typea, a) \
+ static inline __attribute__((__unused__)) \
+ rtype \
+ x(typea a) \
+ { \
+ return mkbi_cat_(__builtin_, x)(a); \
+ }
+#endif
+
+#ifndef mkbi2_
+#define mkbi2_(rtype, x, typea, a, typeb, b) \
+ static inline __attribute__((__unused__)) \
+ rtype \
+ x(typea a, typeb b) \
+ { \
+ return mkbi_cat_(__builtin_, x)(a, b); \
+ }
+#endif
+
+#ifndef mkbi3_
+#define mkbi3_(rtype, x, typea, a, typeb, b, typec, c) \
+ static inline __attribute__((__unused__)) \
+ rtype \
+ x(typea a, typeb b, typec c) \
+ { \
+ return mkbi_cat_(__builtin_, x)(a, b,c); \
+ }
+#endif
+
+#ifdef SHIM_DEPRECATE_STRLEN
+#ifndef mkdepbi_dep_
+#define mkdepbi_dep_ __attribute__((__deprecated__))
+#endif
+#else /* !SHIM_DEPRECATE_STRLEN */
+#ifndef mkdepbi_dep_
+#define mkdepbi_dep_
+#endif
+#endif /* SHIM_DEPRECATE_STRLEN */
+
+#ifndef mkdepbi1_
+#define mkdepbi1_(rtype, x, typea, a) \
+ static inline __attribute__((__unused__)) \
+ mkdepbi_dep_ \
+ rtype \
+ x(typea a) \
+ { \
+ return mkbi_cat_(__builtin_, x)(a); \
+ }
+#endif
+
+#ifndef mkdepbi2_
+#define mkdepbi2_(rtype, x, typea, a, typeb, b) \
+ static inline __attribute__((__unused__)) \
+ mkdepbi_dep_ \
+ rtype \
+ x(typea a, typeb b) \
+ { \
+ return mkbi_cat_(__builtin_, x)(a, b); \
+ }
+#endif
+#endif /* SHIM_STRING_C_ */
+
+// vim:fenc=utf-8:tw=75:noet