Skip to content

Conversation

cosmo0920
Copy link
Contributor

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:

  • Example configuration file for the change
  • Debug log output from testing the change
  • Attached Valgrind output that shows no leaks or memory corruption was found

If this is a change to packaging of containers or native binaries then please confirm it works for all targets.

  • Run local packaging test showing all targets (including any new ones) build.
  • Set ok-package-test label to test for all targets (requires maintainer to do).

Documentation

  • Documentation required for this feature

Backporting

  • Backport to latest stable release.

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.

Copy link
Contributor

@patrick-stephens patrick-stephens left a 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.

@edsiper
Copy link
Member

edsiper commented Jul 29, 2025

I recommend renaming the new option for clarity to FLB_COMPILER_STRICT_POINTER_TYPES

@cosmo0920
Copy link
Contributor Author

I recommend renaming the new option for clarity to FLB_COMPILER_STRICT_POINTER_TYPES

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>
@cosmo0920 cosmo0920 force-pushed the cosmo0920-deny-incompatible-types branch from 9d7cc2d to 2e94779 Compare July 29, 2025 23:15
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")
Copy link
Member

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)

Copy link
Contributor Author

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants