Repository navigation
build(windows): use -O3 like Linux/macOS (drop -O0 special case) - #52
Merged
Merged
Conversation
Windows/MinGW was pinned to -O0 while Linux and macOS use -O3 (-O0 only for USE_COV builds). The WIN32 branch has no explanation in history: git log -S'-O0' traces it back to the initial tree, carried over by 01c2ed2 (Replace the repository with fakelua master). With CMAKE_BUILD_TYPE=Release, CMAKE_CXX_FLAGS_RELEASE appends -O3 after CMAKE_CXX_FLAGS, so the command line was effectively '... -O0 -O3 ...' and GCC used -O3 anyway. The -O0 only applied to builds without a config and made the intent misleading. Drop the WIN32 branch so Windows shares the same policy as Linux: -O0 for coverage builds, -O3 otherwise.
Owner
Author
|
Local verification is complete (Windows / MSYS2 MINGW64, GCC 14.2.0, CMake 3.31.2, Ninja):
No source changes were needed beyond the root |
|
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #52 +/- ##
=======================================
Coverage 89.75% 89.75%
=======================================
Files 125 125
Lines 27231 27231
=======================================
Hits 24441 24441
Misses 2790 2790 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
CMakeLists.txtpinned Windows/MinGW to-O0, while Linux and macOS use-O3(and
-O0only forUSE_COVbuilds). No comment or commit message explains theexception:
git log -S'-O0' -- CMakeLists.txttraces it back to the initial tree,carried over by
01c2ed23(Replace the repository with fakelua master).In practice
CMAKE_BUILD_TYPE=ReleaseappendsCMAKE_CXX_FLAGS_RELEASE(
-O3 -DNDEBUG) afterCMAKE_CXX_FLAGS, so GCC saw... -g3 -ggdb3 -fPIC -O0 -O3 -DNDEBUG ...and used-O3anyway. The-O0only took effect for builds without a build type, which made Windows
inconsistent with Linux and the intent misleading.
Change
IF (WIN32)branch; Windows now shares theELSE ()branch withLinux:
USE_COV=ON->-O0, otherwise-O3(both C and C++).CMakeLists.txt.Verification (Windows / MSYS2 MINGW64, GCC 14.2, Ninja)
-O3and no-O0(grep FLAGS build.ninja).cmake --buildoffakelua+fluais run locally and covered by CI.Note:
CMAKE_BUILD_TYPE=Releasebuilds were already effectively-O3beforethis change, so release binaries are unaffected; only unconfigured builds now
get the intended optimization level (with the usual
-O3+-g3cost in buildtime and binary size).