aklomp / base64

Fast Base64 stream encoder/decoder in C99, with SIMD acceleration
BSD 2-Clause "Simplified" License
865 stars 162 forks source link

error: implicit declaration of function 'bit' is invalid in C99 #146

Closed Hecravi-Sali closed 1 month ago

Hecravi-Sali commented 1 month ago

An error occurred when compiling the project using cmake

error: implicit declaration of function 'bit' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                                if (max_level >= 7 && ((xcr_mask & _AVX_512_ENABLED_BY_OS) == _AVX_512_ENABLED_BY_OS)) {
                                                                   ^
Base64/lib/codec_choose.c:85:76: note: expanded from macro '_AVX_512_ENABLED_BY_OS'
#define _AVX_512_ENABLED_BY_OS (bit_XMM | bit_YMM | bit_OPMASK | bit_ZMM | bit bit_HIGH_ZMM)

I can't understand what is " bit " in _AVX_512_ENABLED_BY_OS macro, Maybe it was just a mistake? The problem occurred after this submission. 819ac85

BurningEnlightenment commented 1 month ago

https://github.com/aklomp/base64/blob/819ac858afc6fd2b40db8e7812d4927433ff8b81/lib/codec_choose.c#L85 @mgaudet can you comment on bit?

mgaudet commented 1 month ago

Sure looks like a typo!

mgaudet commented 1 month ago

(Surprising it built locally!)

mgaudet commented 1 month ago

Yeah... peculiar. I see neither build error nor warning with that patch locally:

matthew@ZenTower:~/tmp/base64$ make
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -o bin/base64.o -c bin/base64.c
cp -f lib/exports.txt lib/exports.build.txt
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/avx512/codec.o -c lib/arch/avx512/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/avx2/codec.o -c lib/arch/avx2/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib -o lib/arch/generic/codec.o -c lib/arch/generic/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/neon32/codec.o -c lib/arch/neon32/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/neon64/codec.o -c lib/arch/neon64/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/ssse3/codec.o -c lib/arch/ssse3/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/sse41/codec.o -c lib/arch/sse41/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/sse42/codec.o -c lib/arch/sse42/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib  -o lib/arch/avx/codec.o -c lib/arch/avx/codec.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib -o lib/lib.o -c lib/lib.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib -o lib/codec_choose.o -c lib/codec_choose.c
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -Ilib -o lib/tables/tables.o -c lib/tables/tables.c
ld -r -o lib/libbase64.o lib/arch/avx512/codec.o lib/arch/avx2/codec.o lib/arch/generic/codec.o lib/arch/neon32/codec.o lib/arch/neon64/codec.o lib/arch/ssse3/codec.o lib/arch/sse41/codec.o lib/arch/sse42/codec.o lib/arch/avx/codec.o lib/lib.o lib/codec_choose.o lib/tables/tables.o
objcopy --keep-global-symbols=lib/exports.build.txt lib/libbase64.o
cc -std=c99 -O3 -Wall -Wextra -pedantic -DBASE64_STATIC_DEFINE -o bin/base64 bin/base64.o lib/libbase64.o

My apologies for this!

Hecravi-Sali commented 1 month ago

I got it, thank you for answering.