llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
29.32k stars 12.12k forks source link

NEON and "error: unknown type name 'inline'" when using -std=c89 #45917

Open 70311826-e6d8-4d29-8604-c4ec4bfa7f0d opened 4 years ago

70311826-e6d8-4d29-8604-c4ec4bfa7f0d commented 4 years ago
Bugzilla Link 46572
Version 7.0
OS Linux
CC @DougGregor,@noloader,@zygoloid

Extended Description

I'm working with a project that wishes to use -std=c89 -pedantic for testing.[1]

Compiling a NEON source file on Aarch64 that uses vector built-ins [2], such as vabdq_u8, results in the following. It looks like Clang disagrees with 'inline' from .

From [1]:

clang blake2s.c -o blake2s -march=armv8-a -O3 -I../testvectors -Wall -Wextra -std=c89 -pedantic -Wno-long-long -DBLAKE2S_SELFTEST

In file included from blake2s.c:19:

/usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:433:1: error: unknown type name 'inline'

ai uint8x16_t vabdq_u8(uint8x16_t __p0, uint8x16_t p1) {

^

/usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:430:21: note: expanded from macro '__ai'

define ai static inline attribute((always_inline, nodebug__))

                ^

/usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:433:1: error: expected identifier or '('

/usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:430:28: note: expanded from macro '__ai'

define ai static inline attribute((always_inline, nodebug__))

                       ^

...

[1] https://travis-ci.org/github/noloader/BLAKE2/jobs/704535809 [2] https://github.com/BLAKE2/BLAKE2/blob/master/power8/blake2s.c

llvmbot commented 4 months ago

@llvm/issue-subscribers-backend-arm

Author: None (70311826-e6d8-4d29-8604-c4ec4bfa7f0d)

| | | | --- | --- | | Bugzilla Link | [46572](https://llvm.org/bz46572) | | Version | 7.0 | | OS | Linux | | CC | @DougGregor,@noloader,@zygoloid | ## Extended Description I'm working with a project that wishes to use -std=c89 -pedantic for testing.[1] Compiling a NEON source file on Aarch64 that uses vector built-ins [2], such as vabdq_u8, results in the following. It looks like Clang disagrees with 'inline' from <arm_neon.h>. From [1]: clang blake2s.c -o blake2s -march=armv8-a -O3 -I../testvectors -Wall -Wextra -std=c89 -pedantic -Wno-long-long -DBLAKE2S_SELFTEST In file included from blake2s.c:19: /usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:433:1: error: unknown type name 'inline' __ai uint8x16_t vabdq_u8(uint8x16_t __p0, uint8x16_t __p1) { ^ /usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:430:21: note: expanded from macro '__ai' #define __ai static inline __attribute__((__always_inline__, __nodebug__)) ^ /usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:433:1: error: expected identifier or '(' /usr/lib/llvm-6.0/lib/clang/6.0.0/include/arm_neon.h:430:28: note: expanded from macro '__ai' #define __ai static inline __attribute__((__always_inline__, __nodebug__)) ^ ... [1] https://travis-ci.org/github/noloader/BLAKE2/jobs/704535809 [2] https://github.com/BLAKE2/BLAKE2/blob/master/power8/blake2s.c