[Python-checkins] bpo-46670: Fix #ifdef in sha3module.c (GH-31180)

vstinner webhook-mailer at python.org
Mon Feb 7 10:22:33 EST 2022


https://github.com/python/cpython/commit/f20ca766fe404a20daea29230f161a0eb71bb489
commit: f20ca766fe404a20daea29230f161a0eb71bb489
branch: main
author: Victor Stinner <vstinner at python.org>
committer: vstinner <vstinner at python.org>
date: 2022-02-07T16:22:24+01:00
summary:

bpo-46670: Fix #ifdef in sha3module.c (GH-31180)

* Test if HAVE_ALIGNED_REQUIRED is defined, not its value.
* Define explicitly NOT_PYTHON macro to 0.

Fix "gcc -Wundef" warnings.

files:
M Modules/_sha3/sha3module.c

diff --git a/Modules/_sha3/sha3module.c b/Modules/_sha3/sha3module.c
index bfa96616df0c9..bffd177c0e753 100644
--- a/Modules/_sha3/sha3module.c
+++ b/Modules/_sha3/sha3module.c
@@ -57,6 +57,8 @@
   typedef uint64_t UINT64;
   typedef unsigned char UINT8;
 #endif
+// kcp/KeccakP-1600-opt64.c doesn't need to define UINT8
+#define NOT_PYTHON 0
 
 /* replacement for brg_endian.h */
 #define IS_LITTLE_ENDIAN 1234
@@ -69,7 +71,7 @@
 #endif
 
 /* Prevent bus errors on platforms requiring aligned accesses such ARM. */
-#if HAVE_ALIGNED_REQUIRED && !defined(NO_MISALIGNED_ACCESSES)
+#if defined(HAVE_ALIGNED_REQUIRED) && !defined(NO_MISALIGNED_ACCESSES)
 #define NO_MISALIGNED_ACCESSES
 #endif
 



More information about the Python-checkins mailing list