Skip to content
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

Merged
merged 8 commits into from
Oct 25, 2019
Merged

Enforce C11/C++11 on Clang, too. #998

merged 8 commits into from
Oct 25, 2019

Conversation

NiLuJe
Copy link
Member

@NiLuJe NiLuJe commented Oct 25, 2019

No description provided.

Otherwise, it faceplants on Darwin because of the lack of constexpr
support.
Copy link
Member

@Frenzie Frenzie left a 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).
Copy link
Member

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

Copy link
Member Author

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. -_-".

Copy link
Member Author

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 ;).

Copy link
Member

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

Copy link
Member

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:

https://github.com/koreader/virdevenv/blob/aea69d62b158dbfbf925e8fa22757848861d5d85/docker/ubuntu/baseimage-clang/clang8.list

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sadface

Copy link
Member

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
@@ -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)
Copy link
Member

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.
Copy link
Member

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

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Member

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?

Copy link
Member Author

@NiLuJe NiLuJe Oct 26, 2019

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'

@NiLuJe NiLuJe merged commit f26a1a6 into koreader:master Oct 25, 2019
NiLuJe added a commit to NiLuJe/koreader that referenced this pull request Oct 25, 2019
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 ;).
NiLuJe added a commit to koreader/koreader that referenced this pull request Oct 26, 2019
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 ;).
mwoz123 pushed a commit to mwoz123/koreader that referenced this pull request Mar 29, 2020
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 ;).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants