fix: replace C-style casts to compile with -Wold-style-cast -Werror#447
Open
ctonneslan wants to merge 1 commit intocameron314:masterfrom
Open
fix: replace C-style casts to compile with -Wold-style-cast -Werror#447ctonneslan wants to merge 1 commit intocameron314:masterfrom
ctonneslan wants to merge 1 commit intocameron314:masterfrom
Conversation
Replace C-style casts that break compilation with -Wold-style-cast -Werror on GCC 14/15 and Clang 17/18 with C++17/20/23. Files changed: - lightweightsemaphore.h: (time_t), (long), (int) -> static_cast - blockingconcurrentqueue.h: (int), (BlockingConcurrentQueue*) -> static_cast/reinterpret_cast Fixes cameron314#444
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.
Summary
Replaces C-style casts with
static_cast/reinterpret_castto allow compilation with strict warning flags (-Wold-style-cast -Werror) on GCC 14/15 and Clang 17/18 with C++17/20/23.Problem
Projects using strict
-Wold-style-cast -Werrorflags cannot include the library headers without compilation errors:Changes
lightweightsemaphore.h:(time_t)(usecs / ...)→static_cast<time_t>(...)(long)(usecs % ...)→static_cast<long>(...)(int)toRelease→static_cast<int>(toRelease)blockingconcurrentqueue.h:(int)Traits::MAX_SEMA_SPINS→static_cast<int>(...)(BlockingConcurrentQueue*)1→reinterpret_cast<BlockingConcurrentQueue*>(1)Fixes #444