CNA-GAP-007: CNA public headers export Sharp Runtime's unprefixed property macros (YES, NO, nothing, ref1, getter1, CONTAINS, INTERNAL and others)

CNA snapshot 009d40f5  ·  Known Issues › Functional gaps  ·  source links pinned to 009d40f5

✓

Evidence basis: source-verified at the pinned commit. Claims on this page were checked by reading the CNA source at commit 009d40f5; unless a sentence says otherwise, nothing here was built or executed. Nothing on this page was executed unless the Evidence section says so.

99 headers under modules/*/include include SharpRuntime/Prop.hpp or SharpRuntimeHelper.hpp, which define 33 short unprefixed macros, so a game translation unit that includes such a CNA header cannot use those spellings as identifiers.

Identifier
CNA-GAP-007
Category
Functional gap
Subsystem
Core & runtime
Status
Open
Verified against
CNA 009d40f5 (009d40f5dd085c4e674d3479675fac84b12b3e0a)
Evidence basis
Source-verified: read at TARGET, not executed
Tests touching this area
None
Affected contract
Any CNA public header that includes SharpRuntime/Prop.hpp or SharpRuntime/SharpRuntimeHelper.hpp (for example Viewport.hpp, ContentManager.hpp, SoundEffect.hpp)

Expected behaviour

Including a framework header should not reserve short, common identifiers in the program's macro namespace; the XNA API a port expects occupies no macro names.

Actual behaviour at TARGET

Viewport.hpp and ContentManager.hpp include SharpRuntime/Prop.hpp; SoundEffect.hpp includes SharpRuntime/SharpRuntimeHelper.hpp; 99 public headers include one of the two. Prop.hpp (sharp-runtime @ 41b918c9, unchanged since 2026-07-25) defines 31 macros, among them YES (1), NO (0), nothing and static0 (empty), ref1 (&), getter1, member0, IF_1 and DEF_PROP; SharpRuntimeHelper.hpp adds CONTAINS(STRING, SUBSTR) and an empty INTERNAL. After such an include, bool NO = false; becomes bool 0 = false; and a variable called nothing disappears.

Source locations

Evidence

Checked by reading at 009d40f5 (a grep of modules/*/include for the two includes) and the two sharp-runtime headers at next @ 41b918c9 in the local checkout (the snapshot pins no revision); not executed. The macros belong to sharp-runtime; the limitation is CNA's because its public headers expose them.

Focused reproduction

// Illustrative; not compiled.
#include "Microsoft/Xna/Framework/Graphics/Viewport.hpp"
bool NO = false;        // preprocesses to: bool 0 = false;  -> error
int nothing = 3;        // preprocesses to: int  = 3;        -> error

Current tests

No test includes CNA headers alongside common identifiers or checks the macro namespace.

Regression test

A compile test that includes every public header and then declares the colliding identifiers; the fix is prefixing the macros in sharp-runtime or keeping Prop.hpp out of CNA's public headers.

Blast radius

Game code that uses any of the 33 spellings as an identifier in a translation unit that includes an affected CNA header. Behaviour of CNA itself is unaffected.

Workaround

Rename the colliding identifiers, or #undef the macro after the last CNA include.

The same subject is explained at several altitudes. These are the neighbouring pages at each one.