openlibm icon indicating copy to clipboard operation
openlibm copied to clipboard

a parameter list without types is only allowed in a function definition

Open sgeto opened this issue 8 years ago • 5 comments

OS: Android 5.0 Architecture: armv7-a (32 bit) Compiler: clang 4.0

Natively building openlibm on Android produces the following error:

➜  openlibm git:(master) make USECLANG=1
clang   -fno-builtin -mhard-float -O3 -fPIC -march=armv7-a -std=c99 -Wall -I/data/data/com.termux/files/home/openlibm -I/data/data/com.termux/files/home/openlibm/include -I/data/data/com.termux/files/home/openlibm/arm -I/data/data/com.termux/files/home/openlibm/src -DASSEMBLER -D__BSD_VISIBLE -Wno-implicit-function-declaration -c src/s_cacos.c -o src/s_cacos.c.o
src/s_cacos.c:64:1: warning: type specifier missing, defaults to 'int'
      [-Wimplicit-int]
__strong_alias(cacosl, cacos);
^
src/s_cacos.c:64:16: error: a parameter list without types is only allowed in a function definition
__strong_alias(cacosl, cacos);
               ^
1 warning and 1 error generated.
make: *** [Make.inc:141: src/s_cacos.c.o] Error 1

Any ideas?

sgeto avatar Sep 07 '17 11:09 sgeto

Same is happening on FreeBSD armv6/7. (aarch64 works fine.) (clang is used on all archs.) __strong_alias is not defined in any headers, might be a compiler builtin thing?

valpackett avatar Jul 12 '18 17:07 valpackett

@ararslan @iblis17 Might you know what is happening here?

ViralBShah avatar Jul 15 '18 14:07 ViralBShah

I think it's __strong_reference on FreeBSD, (and the order of arguments are different) here is a hack https://gist.github.com/iblis17/6f340863fbb233a9326b0c4cbf035746

iblislin avatar Jul 15 '18 19:07 iblislin

Yes, __strong_reference is a thing (in sys/cdefs.h)

#if defined(__GNUC__) || defined(__INTEL_COMPILER)
#ifndef __INTEL_COMPILER
#define	__strong_reference(sym,aliassym)	\
	extern __typeof (sym) aliassym __attribute__ ((__alias__ (#sym)))
#endif
// …
#endif

Hmm, it could be the same on Android, since Bionic libc borrows a lot from *BSD libcs…

valpackett avatar Jul 15 '18 19:07 valpackett

I don't know much about Android or ARM so I don't have a whole lot to contribute here, but some blind Googling suggests that Android may define both __strong_alias and __strong_reference as synonyms. At least that's the case in this Android development kit: https://github.com/crystax/android-platform-ndk/blob/master/sources/crystax/include/sys/cdefs.h#L103-L117.

ararslan avatar Jul 15 '18 22:07 ararslan