C++ contract wrappers moved out of modules
C++ contract wrappers are now built after module processing to fix issues with built-ins and duplicate emissions.
Building C++ contract wrappers within a module context caused problems with built-in declarations and resulted in duplicate wrapper emissions. This change moves the generation of contract wrappers to occur after module processing is complete, effectively placing them in a private module fragment to resolve these issues.
In Details
In GCC's C++ frontend, contract wrappers are now generated by c_parse_final_cleanups after finish_module_processing. This change avoids issues with module imports, specifically concerning built-in declarations like terminate and source_location, and prevents the emission of multiple versions of these wrappers within an importing translation unit.
- C++ modules
- A feature in C++ that allows for more granular control over code organization and visibility, improving build times and encapsulation compared to traditional header files.
- contract wrappers
- Wrapper code generated by the compiler to enforce or manage language contracts, likely related to pre/post conditions or assertions.
- translation unit
- A single source file after all preprocessing directives (like #include) have been processed. It's the basic unit of compilation.