gccrs: Feature gate returns result for better error handling
gccrs's feature gate now returns a result, allowing for more informative feedback on feature status during compilation.
This commit refactors gccrs’s feature gating mechanism by introducing a GateResult enum. The FeatureGate::gate function now returns this enum, indicating whether a feature was successfully gated or encountered an issue. This change improves error reporting and makes the gating status more accessible to other compiler passes, as the gate function is now public.
In Details
The FeatureGate infrastructure in gccrs has been updated. The gate method, now public, returns a new GateResult enum instead of void. This allows callers to ascertain the outcome of the gating process (e.g., if a feature was enabled, disabled, or gated due to policy). This change aims to improve the integration of feature gating with other compiler passes and diagnostics.
- FeatureGate
- A mechanism within GCC (and gccrs) that allows for the experimental or conditional enabling/disabling of language features. It helps manage the introduction of new language constructs.
- enum
- Enumeration. A data type consisting of a set of named constants. In C++ and Rust, it's used to define a type with a fixed set of possible values.
- compiler passes
- Distinct stages or phases within a compiler's pipeline where specific transformations or analyses are applied to the code. Examples include parsing, optimization, and code generation.