Skip to content

Add missing <stdbool.h> include to time.h - #423

Merged
mjcarroll merged 1 commit into
ros2:rollingfrom
banerjs-overland:fix/add-missing-stdbool-include
Aug 6, 2026
Merged

Add missing <stdbool.h> include to time.h#423
mjcarroll merged 1 commit into
ros2:rollingfrom
banerjs-overland:fix/add-missing-stdbool-include

Conversation

@banerjs-overland

Copy link
Copy Markdown
Contributor

rmw/include/rmw/time.h uses bool as the return type of rmw_time_equal() (line 60) but does not include <stdbool.h>. This previously worked because rcutils/time.h transitively pulled in <stdbool.h> via rcutils/types.hhash_map.hallocator.h.

After ros2/rcutils#580 (commit 47a44cb, backported to jazzy as #583) narrowed the include in rcutils/time.h from rcutils/types.h to rcutils/types/rcutils_ret.h, this transitive chain is broken. Any C translation unit that includes rmw/time.h now fails to compile:

  rmw/include/rmw/time.h:60:1: error: unknown type name 'bool'
     60 | bool
        | ^~~~

The fix is to add #include <stdbool.h> to rmw/time.h.

Verification

  /* C translation unit that includes rmw/time.h */
  #include "rmw/time.h"

  void test_func(void) {
      rmw_time_t a = {0, 0};
      rmw_time_t b = {0, 0};
      bool result = rmw_time_equal(a, b);
      (void)result;
  }
  • Create a minimal colcon workspace with rcutils:jazzy and rmw:jazzy (unfixed) and the above C file in a test C package
  • colcon build in the workspace reproduced the above error
  • Changing the rmw package to include the fix in this MR allowed the build to succeed.

Did you use Generative AI?

Claude Opus 4.6

@mergify

mergify Bot commented Aug 3, 2026

Copy link
Copy Markdown

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

@banerjs-overland

banerjs-overland commented Aug 3, 2026

Copy link
Copy Markdown
Contributor Author

Apologies, it looks like I have a lot of unintended commits along for the ride. Fixing. EDIT: Should be fixed now. It was a problem of selecting the wrong base branch

@banerjs-overland
banerjs-overland changed the base branch from rolling to jazzy August 3, 2026 02:23
@banerjs-overland banerjs-overland changed the title Add missing <stdbool.h> include to time.h [Jazzy] Add missing <stdbool.h> include to time.h Aug 3, 2026
@banerjs-overland

Copy link
Copy Markdown
Contributor Author

@wjwwood @ivanpauno Apologies for the direct ping, but any chance one of you may be able to review this PR and provide feedback (I could not figure out a handle for Brandon Ong)? Tagging both of you as documented maintainers of the package. Happy to provide more details or documentation, as necessary.

@fujitatomoya fujitatomoya left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

the fix itself looks good, but we should probably put this into rolling branch and backport downstream branches including jazzy?

The time.h header uses `bool` for the return type of `rmw_time_equal()` but
does not directly include `<stdbool.h>`. This was previously provided
transitively through `rcutils/time.h` -> `rcutils/types.h`, but
ros2/rcutils#580 narrowed that include chain, breaking compilation of
downstream C translation units.

Signed-off-by: Siddhartha Banerjee <sbanerjee@overland.ai>
@banerjs-overland
banerjs-overland force-pushed the fix/add-missing-stdbool-include branch from c8d8d2c to bdf9d85 Compare August 5, 2026 01:13
@banerjs-overland
banerjs-overland changed the base branch from jazzy to rolling August 5, 2026 01:13
@banerjs-overland banerjs-overland changed the title [Jazzy] Add missing <stdbool.h> include to time.h Add missing <stdbool.h> include to time.h Aug 5, 2026
@banerjs-overland

Copy link
Copy Markdown
Contributor Author

@fujitatomoya Thank you for the review! I have reset my branch to rolling and cherry-picked the fix on top of it. Please take a look again when you are able.

@impala454

Copy link
Copy Markdown

Hi can you please backport to humble as well.

@mjcarroll

Copy link
Copy Markdown
Member

@banerjs-overland do you think you can sign off the commit so that the DCO checker will pass?

@banerjs-overland

Copy link
Copy Markdown
Contributor Author

@banerjs-overland do you think you can sign off the commit so that the DCO checker will pass?

@mjcarroll I have signed off on the commit. Unfortunately the DCO check is failing on commits further back in the history of this branch

@mjcarroll

Copy link
Copy Markdown
Member
  • Linux Build Status
  • Linux-aarch64 Build Status
  • Linux-rhel Build Status
  • Windows Build Status

@mjcarroll
mjcarroll merged commit 5f21342 into ros2:rolling Aug 6, 2026
3 checks passed
@mjcarroll

Copy link
Copy Markdown
Member

@Mergifyio backport lyrical kilted jazzy humble

@mergify

mergify Bot commented Aug 6, 2026

Copy link
Copy Markdown

backport lyrical kilted jazzy humble

✅ Backports have been created

Details

mjcarroll pushed a commit that referenced this pull request Aug 6, 2026
The time.h header uses `bool` for the return type of `rmw_time_equal()` but
does not directly include `<stdbool.h>`. This was previously provided
transitively through `rcutils/time.h` -> `rcutils/types.h`, but
ros2/rcutils#580 narrowed that include chain, breaking compilation of
downstream C translation units.

(cherry picked from commit 5f21342)

Signed-off-by: Siddhartha Banerjee <sbanerjee@overland.ai>
Co-authored-by: banerjs-overland <sbanerjee@overland.ai>
@banerjs-overland
banerjs-overland deleted the fix/add-missing-stdbool-include branch August 6, 2026 13:25
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.

4 participants