The header file `longlong.h` makes uses of GNU extensions, this trigger an error when compiling this code with clang. Add a special flag to make clang tolerate this syntax.
Silence the following warnings triggered using W=1: CC lib/mpi/generic_mpih-mul1.o ../lib/mpi/generic_mpih-mul1.c:37:13: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb); ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/mpi/longlong.h:824:20: note: expanded from macro 'umul_ppmm' : "=r" ((USItype) ph) \ ~~~~~~~~~~^~ and CC lib/mpi/generic_mpih-mul2.o ../lib/mpi/generic_mpih-mul2.c:36:13: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb); ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/mpi/longlong.h:824:20: note: expanded from macro 'umul_ppmm' : "=r" ((USItype) ph) \ ~~~~~~~~~~^~ 1 warning generated. CC lib/mpi/generic_mpih-mul3.o ../lib/mpi/generic_mpih-mul3.c:36:13: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions umul_ppmm(prod_high, prod_low, s1_ptr[j], s2_limb); ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ../lib/mpi/longlong.h:824:20: note: expanded from macro 'umul_ppmm' : "=r" ((USItype) ph) \ ~~~~~~~~~~^~ Or even: ../lib/mpi/mpih-div.c:99:16: error: invalid use of a cast in a inline asm context requiring an l-value: remove the cast or build with -fheinous-gnu-extensions sub_ddmmss(n1, n0, n1, n0, d1, d0); ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~ Cc: Joel Stanley <j...@jms.id.au> Cc: Masahiro Yamada <yamada.masah...@socionext.com> Signed-off-by: Mathieu Malaterre <ma...@debian.org> --- lib/mpi/Makefile | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/mpi/Makefile b/lib/mpi/Makefile index d5874a7f5ff9..de4d96e988a3 100644 --- a/lib/mpi/Makefile +++ b/lib/mpi/Makefile @@ -5,6 +5,13 @@ obj-$(CONFIG_MPILIB) = mpi.o +ifdef CONFIG_CC_IS_CLANG +CFLAGS_generic_mpih-mul1.o += -fheinous-gnu-extensions +CFLAGS_generic_mpih-mul2.o += -fheinous-gnu-extensions +CFLAGS_generic_mpih-mul3.o += -fheinous-gnu-extensions +CFLAGS_mpih-div.o += -fheinous-gnu-extensions +endif + mpi-y = \ generic_mpih-lshift.o \ generic_mpih-mul1.o \ -- 2.20.1