-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Enforce C11/C++11 on Clang, too. #998
Conversation
Otherwise, it faceplants on Darwin because of the lack of constexpr support.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good
Makefile.defs
Outdated
CSTD_FLAGS:=-std=c11 | ||
CXXSTD_FLAGS:=-std=c++11 | ||
else | ||
# Keep GNU extensions enabled on Linux (mainly because the CI's Clang version sucks so very hard). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To be clear, that's Clang 8, the latest - 1. I'll probably update it to 9 sometime. Not some curious archeological find from the depths of Ubuntu 16.04. :-P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are you sure it's Clang 8? o_O.
FWIW, luajit builds just fine w/ c11 on Linux w/ Clang 9, and macOS w/ Xcode 11. -_-".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unless Ubuntu mangles LLVM/Clang beyond recognition, which wouldn't surprise me all that much ;).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite sure:
$ docker run koreader/kobase-clang:0.1.2 clang --version
clang version 8.0.1-svn363027-1~exp1~20190611212422.76 (branches/release_80)
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin
Also: #944
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't matter if Ubuntu does or doesn't; it comes straight from the horse's mouth:
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sadface
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
koreader/virdevenv#45 is ready to go
Just enforce current defaults. XCode works in mysterious ways, I guess. I'd be inclined to hide this behind a DARWIN check, but, it's currently harmless.
Appears to be smart enough not to downgrade a default/specified std, so, yay. c.f., https://cmake.org/cmake/help/latest/manual/cmake-compile-features.7.html
LLVM/CLang's doc status is... weird.
@@ -161,5 +155,7 @@ set (CRENGINE_SOURCES | |||
${CRE_DIR}/src/xxhash.c | |||
) | |||
add_library(crengine SHARED ${CRENGINE_SOURCES}) | |||
# Make sure we'll get C++11 support | |||
target_compile_features(crengine PRIVATE cxx_constexpr) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, that was the most helpful CMake man page I've ever seen.
Makefile.defs
Outdated
@@ -449,7 +449,7 @@ else | |||
CSTD_FLAGS:=-std=c11 | |||
CXXSTD_FLAGS:=-std=c++11 | |||
else | |||
# Keep GNU extensions enabled on Linux (mainly because the CI's Clang version sucks so very hard). | |||
# Keep GNU extensions enabled on Linux, otherwise Clang < 9 fails to build LuaJIT. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But how do we know that's an accurate comment? :-P
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather, I mean who says Clang 9 does?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I do ;p.
clang -O2 -fomit-frame-pointer -Wall -std=c11 -march=native -pipe -O2 -fomit-frame-pointer -frename-registers -fweb -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE -DLUA_MULTILIB=\"lib\" -fno-stack-protector -c -o ljamalg.o ljamalg.c
clang-9: warning: optimization flag '-frename-registers' is not supported [-Wignored-optimization-argument]
clang-9: warning: optimization flag '-fweb' is not supported [-Wignored-optimization-argument]
gcc-ar rcus 2>/dev/null libluajit.a lj_vm.o ljamalg.o
clang -O2 -fomit-frame-pointer -Wall -std=c11 -march=native -pipe -O2 -fomit-frame-pointer -frename-registers -fweb -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE -DLUA_MULTILIB=\"lib\" -fno-stack-protector -Wl,-O1 -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--as-needed -shared -fPIC -Wl,-soname,libluajit-5.1.so.2 -o libluajit.so lj_vm_dyn.o ljamalg_dyn.o -lm -ldl
gcc-ranlib libluajit.a
strip --strip-unneeded libluajit.so
clang -O2 -fomit-frame-pointer -Wall -std=c11 -march=native -pipe -O2 -fomit-frame-pointer -frename-registers -fweb -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -U_FORTIFY_SOURCE -DLUA_MULTILIB=\"lib\" -fno-stack-protector -Wl,-O1 -Wl,--sort-common -Wl,--hash-style=gnu -Wl,--as-needed -Wl,-E -o luajit luajit.o libluajit.a -lm -ldl
strip --strip-unneeded luajit
make[2]: Leaving directory '/var/tmp/niluje/luajit-2.0/src'
Pickup koreader/koreader-base#997 & koreader/koreader-base#998 The most user-visible fix being startup in non-standard orientations on the Libra no longer being broken ;).
Pickup koreader/koreader-base#997 & koreader/koreader-base#998 The most user-visible fix being startup in non-standard orientations on the Libra no longer being broken ;).
Pickup koreader/koreader-base#997 & koreader/koreader-base#998 The most user-visible fix being startup in non-standard orientations on the Libra no longer being broken ;).
No description provided.