Access to enum definition at run time
Project / Subsystem
gcc / gcc
Date
2026-04-30
Proposer
Yair Lenga <yair.lenga@gmail.com>
Source type
public_inbox
Consensus
Under Review
Sentiment
—/10
Technical tradeoffs
- • Increased compile time due to plugin execution.
- • Potential for increased object file size due to injected metadata.
- • Complexity of maintaining a GCC plugin.
- • Alternative approaches exist, such as using C++26 reflection or post-compile DWARF analysis.
All attributes
- project
- gcc
- subsystem
- gcc
- patch_id
- —
- discussion_id
- CAK3_KpMGe9WQ4iOEistwQKgNrcVaMp=RoE0WD-Dq=SBFpsu+mA@mail.gmail.com
- source_type
- public_inbox
- title
- Access to enum definition at run time
- headline
- Access to enum definition at run time
- tldr
- Yair Lenga seeks feedback on a GCC plugin that generates enum metadata at compile time for runtime access in C.
- proposer
- Yair Lenga <yair.lenga@gmail.com>
- consensus
- Under Review
- outcome
- proposed
- sentiment_score
- —
- technical_tradeoffs
-
- • Increased compile time due to plugin execution.
- • Potential for increased object file size due to injected metadata.
- • Complexity of maintaining a GCC plugin.
- • Alternative approaches exist, such as using C++26 reflection or post-compile DWARF analysis.
- series_id
- —
- series_role
- standalone
- series_parts
- []
- tags
-
- • gcc
- • plugin
- • enum
- • reflection
- • c
- url
- https://inbox.sourceware.org/gcc/CAK3_KpMGe9WQ4iOEistwQKgNrcVaMp=RoE0WD-Dq=SBFpsu+mA@mail.gmail.com
- bugzilla_url
- —
- date
- 2026-04-30T00:00:00.000Z
Access to enum definition at run time
Yair Lenga is seeking feedback on a GCC plugin that extracts enum definitions and generates C structures to support runtime lookup and enumeration. The current implementation relies on a Python tool to extract enum definitions from the DWARF section, but Lenga is experimenting with a GCC plugin to perform this generation at compile time. He is looking for feedback on the idea, the plugin implementation, and the possibility of making it an official GCC extension.