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

testsuite: Add plugin to verify bits/std.cc exports

A new GCC plugin verifies that all necessary symbols from `bits/std.cc` are exported, preventing omissions in the standard library's module interface.

This commit introduces a new GCC plugin to verify that all necessary symbols from bits/std.cc are exported. The plugin identifies symbols within the std namespace and its children that are not exported from the module and are not deprecated. The plugin helps to prevent accidental omissions of symbols from the standard library’s module interface. New test cases are added for C++20, C++23, and C++26 to ensure the correct behavior of the plugin across different language standards.

In Details

The commit adds g++.dg/plugin/std_module_exports_plugin.cc, which verifies whether symbols in the std namespace and its children are exported from the module. The plugin checks for the absence of DECL_MODULE_EXPORT_P on declarations, but also considers OVL_EXPORT_P on overloads and handles inline namespaces using USING_DECL. The plugin reports missing exports as errors and is tested with std-module-exports-c++{20,23,26}.C.

For Context

This commit adds a plugin to the GCC testsuite to ensure the completeness of the C++ standard library's module interface. C++ modules are a way to organize code into separate, reusable units. The plugin checks that all the necessary symbols defined in the internal implementation file bits/std.cc are properly exported when the standard library is used as a module. This ensures that code using the standard library as a module will have access to all the required functionality.

Filed Under: testsuitepluginmoduleslibstdc++