stop pasting a directive name onto the comma after it

DIRECTIVE_TEXT builds four enumerator names from one directive name:

    #define DIRECTIVE_TEXT(id)  RCDT_##id##, RCDT_##id##_EFFECT, ...

The last ## on the first name has nothing to paste onto but the comma that
follows, and RCDT_GATHER_SUPPLIES, is not a token. The other three pastes are
well formed; only this one runs off the end of the name.

MSVC concatenates the text and re-lexes it, so it recovers the identifier and
the comma and produces the right enumerators; clang diagnoses it. Removing the
stray ## gives the same ten enumerations, and MISSION_TEXT just below already
spells it this way.

Verification:

    grep -rn '##[A-Za-z_]*##[,)]' --include=*.h --include=*.cpp .   # nothing
    ninja -C build parse         # token-paste class gone: 55 -> 45 sites
    ninja -C build -k 0          # Release, four applications, green
    ninja -C build-debug -k 0    # Debug, four applications, green

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Marco Antonio J. Costa
2026-07-23 19:29:55 -03:00
committed by majcosta
co-authored by Claude Opus 4.8
parent 3db2d60a4d
commit c99f939fe6
+1 -1
View File
@@ -106,7 +106,7 @@ Points of interest:
#include <unordered_map>
#include <unordered_set>
#define DIRECTIVE_TEXT(id) RCDT_##id##, RCDT_##id##_EFFECT, RCDT_##id##_DESC, RCDT_##id##_IMPROVE,
#define DIRECTIVE_TEXT(id) RCDT_##id, RCDT_##id##_EFFECT, RCDT_##id##_DESC, RCDT_##id##_IMPROVE,
#define MISSION_TEXT(id) RCAMT_##id##_TITLE, RCAMT_##id##_DESC,
#define ADMIN_ACTION_CHANGE_COST 15000