summaryrefslogtreecommitdiff
path: root/include/system/builtins_begin_.h
diff options
context:
space:
mode:
authorSteve McIntyre <steve@einval.com>2021-03-23 23:49:46 +0000
committerSteve McIntyre <steve@einval.com>2021-03-23 23:49:46 +0000
commit1251a7ba86fc40a6aad8b4fecdbca2b61808d9fa (patch)
tree2125fda549aaca55cb49a48d54be77dec7fbf3df /include/system/builtins_begin_.h
parent85b409232ce89b34626df9d72abedf5d4f5ccef6 (diff)
parent031e5cce385d3f96b1caa1d53495332a7eb03749 (diff)
downloadefi-boot-shim-debian/15.3-1.tar.gz
efi-boot-shim-debian/15.3-1.zip
Update upstream source from tag 'upstream/15.3'debian/15.3-1
Update to upstream version '15.3' with Debian dir 1b484f1c1ac270604a5a1451b34de4b0865c6211
Diffstat (limited to 'include/system/builtins_begin_.h')
-rw-r--r--include/system/builtins_begin_.h65
1 files changed, 65 insertions, 0 deletions
diff --git a/include/system/builtins_begin_.h b/include/system/builtins_begin_.h
new file mode 100644
index 00000000..2686c41c
--- /dev/null
+++ b/include/system/builtins_begin_.h
@@ -0,0 +1,65 @@
+// SPDX-License-Identifier: BSD-2-Clause-Patent
+/**
+ * macros to build function declarations with the same types as builtins
+ * that we apparently really cannot depend on.
+ */
+
+/*
+ * Clang's __builtin_whatever and __typeof__ are broken thusly:
+ * In file included from MokManager.c:2:
+ * In file included from shim.h:47:
+ * include/system/string.h:29:1: error: builtin functions must be directly called
+ * mkbi1_(long int, ffsl, long int, x)
+ * ^
+ */
+#if defined(__clang__)
+
+#ifndef mkbi1_
+#define mkbi1_(rtype, x, typea, a) rtype x(typea a);
+#endif
+
+#ifndef mkbi2_
+#define mkbi2_(rtype, x, typea, a, typeb, b) rtype x(typea a, typeb b);
+#endif
+
+#ifndef mkbi3_
+#define mkbi3_(rtype, x, typea, a, typeb, b, typec, c) rtype x(typea a, typeb b, typec c);
+#endif
+
+#ifndef mkdepbi1_
+#define mkdepbi1_(rtype, x, typea, a) rtype x(typea a);
+#endif
+
+#ifndef mkdepbi2_
+#define mkdepbi2_(rtype, x, typea, a, typeb, b) rtype x(typea a, typeb b);
+#endif
+
+#else /* !__clang__ */
+
+#ifndef mkbi_cat_
+#define mkbi_cat_(a, b) a##b
+#endif
+
+#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
+
+#endif /* !__clang__ */
+
+// vim:fenc=utf-8:tw=75:noet