Make libgcrypt build with Clang on i386
authorJussi Kivilinna <jussi.kivilinna@iki.fi>
Sat, 21 Sep 2013 10:54:38 +0000 (13:54 +0300)
committerJussi Kivilinna <jussi.kivilinna@iki.fi>
Thu, 26 Sep 2013 09:14:20 +0000 (12:14 +0300)
* cipher/longlong.h [__i386__] (add_ssaaaa, sub_ddmmss)
(umul_ppmm, udiv_qrnnd): Do not cast asm output to USItype.
--

Clang defines __GNUC__ even when it's not GCC compatible. As result Clang
enables GCC-only assembly code in mpi/longlong.h and fails to build.

However, since changes to make libgcrypt build with Clang are smallish, and
changes do not cause problems with GCC, patch just does them.

Signed-off-by: Jussi Kivilinna <jussi.kivilinna@iki.fi>
mpi/longlong.h

index 773d1c7..4e315df 100644 (file)
@@ -468,8 +468,8 @@ extern USItype __udiv_qrnnd ();
 #define add_ssaaaa(sh, sl, ah, al, bh, bl) \
   __asm__ ("addl %5,%1\n"                                               \
           "adcl %3,%0"                                                 \
-          : "=r" ((USItype)(sh)),                                      \
-            "=&r" ((USItype)(sl))                                      \
+          : "=r" ((sh)),                                               \
+            "=&r" ((sl))                                               \
           : "%0" ((USItype)(ah)),                                      \
             "g" ((USItype)(bh)),                                       \
             "%1" ((USItype)(al)),                                      \
@@ -478,8 +478,8 @@ extern USItype __udiv_qrnnd ();
 #define sub_ddmmss(sh, sl, ah, al, bh, bl) \
   __asm__ ("subl %5,%1\n"                                               \
           "sbbl %3,%0"                                                 \
-          : "=r" ((USItype)(sh)),                                      \
-            "=&r" ((USItype)(sl))                                      \
+          : "=r" ((sh)),                                               \
+            "=&r" ((sl))                                               \
           : "0" ((USItype)(ah)),                                       \
             "g" ((USItype)(bh)),                                       \
             "1" ((USItype)(al)),                                       \
@@ -487,15 +487,15 @@ extern USItype __udiv_qrnnd ();
           __CLOBBER_CC)
 #define umul_ppmm(w1, w0, u, v) \
   __asm__ ("mull %3"                                                    \
-          : "=a" ((USItype)(w0)),                                      \
-            "=d" ((USItype)(w1))                                       \
+          : "=a" ((w0)),                                               \
+            "=d" ((w1))                                                \
           : "%0" ((USItype)(u)),                                       \
             "rm" ((USItype)(v))                                        \
           __CLOBBER_CC)
 #define udiv_qrnnd(q, r, n1, n0, d) \
   __asm__ ("divl %4"                                                    \
-          : "=a" ((USItype)(q)),                                       \
-            "=d" ((USItype)(r))                                        \
+          : "=a" ((q)),                                                \
+            "=d" ((r))                                                 \
           : "0" ((USItype)(n0)),                                       \
             "1" ((USItype)(n1)),                                       \
             "rm" ((USItype)(d))                                        \