-
Notifications
You must be signed in to change notification settings - Fork 1.7k
build: workflows: Add a rules for denying incompatible types #10655
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
base: master
Are you sure you want to change the base?
Conversation
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.
We should update to Ubuntu 24 soon really as well, it is the latest one so 22 will go.
I recommend renaming the new option for clarity to |
Sounds good. I'll rename it later. |
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
This is because this behavior is default since gcc 14 or later. But our CI is still using ubuntu-22.04 as a base testing workers. So, we need to implement an additional task for denying incompatible types for pointer operations. Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
9d7cc2d
to
2e94779
Compare
CMakeLists.txt
Outdated
@@ -436,6 +437,12 @@ if(FLB_COVERAGE) | |||
set(CMAKE_BUILD_TYPE "Debug") | |||
endif() | |||
|
|||
if(FLB_COMPILER_STRICT_POINTER_TYPES) | |||
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang") | |||
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=incompatible-pointer-types") |
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.
maybe this is a bit cleaner: add_compile_options(-Wincompatible-pointer-types)
(needs to be tested)
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 used as follows:
if(FLB_COMPILER_STRICT_POINTER_TYPES)
if(CMAKE_C_COMPILER_ID MATCHES "GNU|Clang|AppleClang")
add_compile_options(-Werror=incompatible-pointer-types)
endif()
# Currently, AppleClang has more struct rules when using -Werror=incompatible-pointer-types.
# We still permit to discarding const qualifiers warnings.
if(CMAKE_C_COMPILER_ID MATCHES "AppleClang")
add_compile_options(-Wno-incompatible-pointer-types-discards-qualifiers)
endif()
endif()
Plus, AppleClang has more struct rules for incompatible pointer types.
Frequently, we discarded for constqualifiers so we still needed to permit this type on incompatibilities on macOS's toolchain.
Signed-off-by: Hiroshi Hatake <hiroshi@chronosphere.io>
This is because this behavior is default since gcc 14 or later.
But our CI is still using ubuntu-22.04 as a base testing workers.
So, we need to implement an additional task for denying incompatible
types for pointer operations.
Enter
[N/A]
in the box, if an item is not applicable to your change.Testing
Before we can approve your change; please submit the following in a comment:
If this is a change to packaging of containers or native binaries then please confirm it works for all targets.
ok-package-test
label to test for all targets (requires maintainer to do).Documentation
Backporting
Fluent Bit is licensed under Apache 2.0, by submitting this pull request I understand that this code will be released under the terms of that license.