From: Diogo N. Sampaio Date: Wed, 5 Sep 2018 14:56:21 +0000 (+0000) Subject: Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2d5c20fae345fa78684af5bbf6cac59c79828834;p=clang Fix arm_neon.h and arm_fp16.h generation for compiling with std=c89 Summary: The inline attribute is not valid for C standard 89. Replace the argument in the generation of header files with __inline, as well adding tests for both header files. Reviewers: pbarrio, SjoerdMeijer, javed.absar, t.p.northover Subscribers: t.p.northover, kristof.beyls, chrib, cfe-commits Differential Revision: https://reviews.llvm.org/D51683 test/Headers/arm-fp16-header.c test/Headers/arm-neon-header.c utils/TableGen/NeonEmitter.cpp git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@341475 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/test/Headers/arm-fp16-header.c b/test/Headers/arm-fp16-header.c new file mode 100644 index 0000000000..dd9ee078d0 --- /dev/null +++ b/test/Headers/arm-fp16-header.c @@ -0,0 +1,19 @@ +// RUN: %clang -fsyntax-only -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c89 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c99 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c11 -xc %s + +// RUN: %clang -fsyntax-only -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c89 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c99 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c11 -xc %s + +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++98 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++11 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++14 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++17 -xc++ %s + +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++98 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++11 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++14 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++17 -xc++ %s + +#include diff --git a/test/Headers/arm-neon-header.c b/test/Headers/arm-neon-header.c index 90ea22bc96..fd6ef7843a 100644 --- a/test/Headers/arm-neon-header.c +++ b/test/Headers/arm-neon-header.c @@ -2,4 +2,23 @@ // RUN: %clang_cc1 -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -fno-lax-vector-conversions -ffreestanding %s // RUN: %clang_cc1 -x c++ -triple thumbv7-apple-darwin10 -target-cpu cortex-a8 -fsyntax-only -Wvector-conversions -ffreestanding %s +// RUN: %clang -fsyntax-only -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c89 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c99 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c11 -xc %s + +// RUN: %clang -fsyntax-only -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c89 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c99 -xc %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c11 -xc %s + +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++98 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++11 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++14 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-arm-none-eabi -march=armv8.2-a+fp16 -std=c++17 -xc++ %s + +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++98 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++11 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++14 -xc++ %s +// RUN: %clang -fsyntax-only -Wall -Werror -ffreestanding --target=aarch64-armeb-none-eabi -march=armv8.2-a+fp16 -std=c++17 -xc++ %s + #include + diff --git a/utils/TableGen/NeonEmitter.cpp b/utils/TableGen/NeonEmitter.cpp index eca03a5892..c7ff0040f4 100644 --- a/utils/TableGen/NeonEmitter.cpp +++ b/utils/TableGen/NeonEmitter.cpp @@ -2409,7 +2409,7 @@ void NeonEmitter::run(raw_ostream &OS) { OS << "#endif\n"; OS << "\n"; - OS << "#define __ai static inline __attribute__((__always_inline__, " + OS << "#define __ai static __inline __attribute__((__always_inline__, " "__nodebug__))\n\n"; SmallVector Defs; @@ -2518,7 +2518,7 @@ void NeonEmitter::runFP16(raw_ostream &OS) { OS << "typedef __fp16 float16_t;\n"; - OS << "#define __ai static inline __attribute__((__always_inline__, " + OS << "#define __ai static __inline __attribute__((__always_inline__, " "__nodebug__))\n\n"; SmallVector Defs;