Closed stefanos82 closed 1 year ago
What is your GCC version?
gcc version 12.2.0 (Debian 12.2.0-3)
Update: with Debian clang version 14.0.6-2
works as expected.
Is it a GCC bug?
For GCC, seems like fallthrough
comment must come right before the case
, but there is a }
between, I will provide a fix.
Nice! Now it works as expected.
By the way, I got these lto warning messages during compilation procedure with make optimized-nelua-lua
:
make --no-print-directory CFLAGS="-march=native -O3 -flto -fno-plt -fno-stack-protector -fprofile-generate=pgo" clean-nelualua default
rm -f nelua-lua
gcc \
-DMAXRECLEVEL=400 -DLUA_USE_RPMALLOC -DNDEBUG -DLUA_USE_LINUX \
-Isrc/lua \
-march=native -O3 -flto -fno-plt -fno-stack-protector -fprofile-generate=pgo \
src/hasher.c src/lfs.c src/luainit.c src/onelua.c src/sys.c src/lpeglabel/lpcap.c src/lpeglabel/lpcode.c src/lpeglabel/lpprint.c src/lpeglabel/lptree.c src/lpeglabel/lpvm.c src/srpmalloc/srpmalloc.c \
-o nelua-lua \
-Wl,-E -lm -ldl
lto-wrapper: warning: using serial compilation of 13 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
./nelua -qb tests/all_test.nelua
make --no-print-directory CFLAGS="-march=native -O3 -flto -fno-plt -fno-stack-protector -fprofile-use=pgo" clean-nelualua default
rm -f nelua-lua
gcc \
-DMAXRECLEVEL=400 -DLUA_USE_RPMALLOC -DNDEBUG -DLUA_USE_LINUX \
-Isrc/lua \
-march=native -O3 -flto -fno-plt -fno-stack-protector -fprofile-use=pgo \
src/hasher.c src/lfs.c src/luainit.c src/onelua.c src/sys.c src/lpeglabel/lpcap.c src/lpeglabel/lpcode.c src/lpeglabel/lpprint.c src/lpeglabel/lptree.c src/lpeglabel/lpvm.c src/srpmalloc/srpmalloc.c \
-o nelua-lua \
-Wl,-E -lm -ldl
lto-wrapper: warning: using serial compilation of 6 LTRANS jobs
lto-wrapper: note: see the ‘-flto’ option documentation for more information
rm -rf pgo
Thanks for also reporting that, recent GCC started to require parameters in -flto
, I've pushed a fix in https://github.com/edubart/nelua-lang/commit/d0d38599cfe89094a3c9244f7919fc91a37f2760
I was playing with
overview.nelua
and have noticed the usage offallthrough
.I went to
https://nelua.io/overview/#fallthrough
and run the following example withnelua -SV
.It threw the following warning:
I opened the generated file and saw this
/* fallthrough */
comment in generated code:For some reason GCC does not respect it.
Now, if I add a macro condition to validate GCC's existence and its version is greater than or equal to
5
, I use GCC's attribute instead:This way it compiles without any complain.
Do you have any idea why GCC does not respect the
fallthrough
comment?