Mailing List Archive

[PATCH] Fix build of jitterentropy-base.c with clang
Clang has a slightly different pragma to disable optimizations.
---
random/jitterentropy-base.c | 9 +++++++++
1 file changed, 9 insertions(+)

diff --git a/random/jitterentropy-base.c b/random/jitterentropy-base.c
index 32fdea46..2c198ef5 100644
--- a/random/jitterentropy-base.c
+++ b/random/jitterentropy-base.c
@@ -50,6 +50,14 @@
*/

#undef _FORTIFY_SOURCE
+#ifdef __clang__
+#pragma clang optimize off
+
+/* clang does not undefine the __OPTIMIZE__ macro after using the
+ * clang optimize off pragma, so the same __OPTIMIZE__ check below that
+ * is used for gcc won't work.
+ */
+#else
#pragma GCC optimize ("O0")

#include "jitterentropy.h"
@@ -60,6 +68,7 @@
#error "The CPU Jitter random number generator must not be compiled with optimizations. See documentation. Use the compiler switch -O0 for compiling jitterentropy-base.c."
#endif
#endif
+#endif

#define MAJVERSION 2 /* API / ABI incompatible changes, functional changes that
* require consumer to be updated (as long as this number
--
2.26.2


_______________________________________________
Gcrypt-devel mailing list
Gcrypt-devel@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gcrypt-devel