GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
ada

Ada reuses Is_Rewrite_Substitution where possible

The Ada front end refactors code to consolidate checks using `Is_Rewrite_Substitution` for clarity.

This commit refactors parts of the Ada front end by replacing low-level inequality checks with calls to the higher-level Is_Rewrite_Substitution routine. This change is purely for code cleanup and does not alter the compiler’s behavior or generated code. It aims to improve the readability and maintainability of the Ada compiler’s internal logic.

In Details

In the GCC Ada front end, various modules like errout.adb, exp_util.adb, sem_case.adb, sem_ch4.adb, and sem_res.adb perform checks related to rewrite substitutions. This commit consolidates these checks by replacing direct low-level logical inequalities with calls to the existing Is_Rewrite_Substitution utility function. This is a refactoring effort to improve code consistency and maintainability without introducing semantic changes.

For Context

Compilers are complex pieces of software, and like any large codebase, they benefit from good organization and clear code. This change in the Ada part of GCC is a 'code cleanup' effort. It replaces several instances where the compiler was checking for a specific condition (related to 'rewrite substitutions') using basic, low-level comparisons. Instead, it now uses a dedicated function, Is_Rewrite_Substitution, for these checks. This doesn't change how the compiler behaves or what code it produces, but it makes the compiler's own code easier for developers to read, understand, and maintain in the future.

Filed Under: adarefactoringcompiler internals