Skip to content

Fix mismatched header guard in todimpl.h coverage stub - #490

Open
camdenconrad wants to merge 1 commit into
nasa:devfrom
camdenconrad:fix-todimpl-header-guard-typo
Open

Fix mismatched header guard in todimpl.h coverage stub#490
camdenconrad wants to merge 1 commit into
nasa:devfrom
camdenconrad:fix-todimpl-header-guard-typo

Conversation

@camdenconrad

@camdenconrad camdenconrad commented Jul 12, 2026

Copy link
Copy Markdown

Fixes #491

Describe the contribution

The coverage stub unit-test-coverage/ut-stubs/override_inc/rtems/score/todimpl.h has a mismatched include guard. The #ifndef checks OVERRIDE_TOOIMPL_H, but the #define sets OVERRIDE_TODIMPL_H. Because the two names differ, the guard macro is never actually defined when the guard is evaluated, so the header is not protected against double inclusion.

This corrects the #ifndef to OVERRIDE_TODIMPL_H so it matches the #define and the file name, consistent with the other override stubs in this directory (for example OVERRIDE_THREADIMPL_H in threadimpl.h).

No functional or behavioral change is intended; this only repairs the include guard.

Testing performed

Built the native_std configuration (cFE, OSAL, PSP, and the sample apps) and confirmed the tree compiles and CFE boots to the OPERATIONAL state. The mismatch is also flagged by newer compilers under -Wheader-guard; with -Werror enabled this caused a build failure that is resolved by this change.

Expected behavior changes

None. The include guard now functions as intended.

System(s) tested on

  • OS: Manjaro Linux (kernel 6.12)
  • Compiler: GCC 16.1.1
  • cFS bundle: current dev, PSP at the pinned submodule commit

Additional context

The mismatch surfaces as a hard error only on compilers that enable -Wheader-guard (such as recent GCC) when built with -Werror. On older compilers it is silent, which is likely why it has gone unnoticed.

Contributor Info

Camden Conrad (@camdenconrad)

The include guard used #ifndef OVERRIDE_TOOIMPL_H but #define
OVERRIDE_TODIMPL_H, so the guard macro was never actually defined and
the header was not protected against double inclusion. Correct the
#ifndef to OVERRIDE_TODIMPL_H to match the #define and the file name,
consistent with the other override stubs (e.g. OVERRIDE_THREADIMPL_H).

This also resolves a -Werror=header-guard build failure on newer GCC.

Signed-off-by: Camden Conrad <camdenconrad1@gmail.com>
@camdenconrad
camdenconrad force-pushed the fix-todimpl-header-guard-typo branch from 6288d96 to cc8f3e2 Compare July 13, 2026 14:32
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.

Mismatched include guard in todimpl.h coverage stub (OVERRIDE_TOOIMPL_H vs OVERRIDE_TODIMPL_H)

2 participants