libstdc++: Make make_decimalN functions inline for module support.
Decimal number creation functions in libstdc++ are now inline to enable usage with C++ modules.
The make_decimal32, make_decimal64, and make_decimal128 functions in decimal/decimal.h were previously declared static, giving them internal linkage and preventing their use in C++ modules. By changing them to inline, these functions now have external linkage with vague-linkage semantics, allowing them to be shared across translation units and exported when consumed as header units or within module purview, resolving PR122071.
In Details
The make_decimalN overloads in <decimal/decimal.h> have been transitioned from static (internal linkage) to inline (external linkage, vague-linkage). This change is necessary to support C++20 modules, where functions with internal linkage cannot be exported. Inline functions provide the required semantics for visibility and linkage when the header is used in a module context, resolving PR libstdc++/122071.
- internal linkage
- A declaration that makes a function or variable only visible within the current translation unit (source file).
- external linkage
- A declaration that makes a function or variable visible across multiple translation units.
- vague-linkage
- A linkage specification in C++ that allows different translation units to provide definitions for the same name, typically used for inline functions and template instantiations.
- C++ modules
- A feature in C++20 that provides a more efficient and organized way to structure code, replacing traditional header files.
- translation unit
- A single source file after preprocessing, ready to be compiled.