On Wed, Mar 18, 2026 at 4:44 PM Jakub Jelinek <[email protected]> wrote:
> On Wed, Mar 18, 2026 at 04:21:49PM +0100, Tomasz Kaminski wrote: > > On Wed, Mar 18, 2026 at 4:16 PM Jakub Jelinek <[email protected]> wrote: > > > > > On Wed, Mar 18, 2026 at 03:56:17PM +0100, Tomasz Kaminski wrote: > > > > > Here is a new version of the plugin. > > > > > As requested, it doesn't diagnose any of the headers outside of > > > > > <bits/stdc++.h>, for -std=c++26 tests with also -freflection > > > -fcontracts > > > > > for now, contains a self test for the plugin to make sure it > diagnoses > > > > > stuff it should diagnose and doesn't what it shouldn't, walks > template > > > > > specializations, walks non-template functions inside of templates, > > > > > adds GC support to the plugin, whitelists submdspan_mapping > manually > > > > > for C++26, > > > > > > > > Why exactly submdspan_mapping needs a special treatment, it should > > > > be no different from other ADL-only calls in the library, like > begin/end? > > > > > > The plugin automatically whitelists non-uglified names of declarations > > > that it > > > sees in the std namespace and nested namespaces and in classes/class > > > templates > > > thereof except for declarations inside of non-inline _ prefixed > namespaces, > > > trying to roughly reconstruct what is in > > > https://eel.is/c++draft/libraryindex . > > > The whitelisted ones are reported by the plugin too, but with a > different > > > wording which doesn't make the testcase to fail. > > > And begin/end are whitelisted that way, submdspan_mapping is not. > > > E.g. > > > libstdc++-v3/include/bits/unicode.h:160:7: note: non-uglified > whitelisted > > > name 'begin' > > > libstdc++-v3/include/bits/unicode.h:738:22: note: non-uglified > whitelisted > > > name 'end' > > > > > We have a hidden friend declaration of submdspan_mapping both in the > > standard > > and in our implementation for each layout. For example in > > libstdc++/include/std/mdspan:2780. > > Indeed, the plugin doesn't report anything on > // Test that uglification_plugin.cc works properly. > // { dg-options "-O0 -std=c++20" } > > // Pretend this is in a libstdc++-v3 header. > #line 6 "gcc/libstdc++-v3/include/bits/universe.h" > > namespace std { > template <int> > struct foo { > template <int> > friend int bar (int x) { > int y = x; > return y; > } > }; > } > (or if either of those template lines are commented out but not > both). > I the plugin should walk even those, will need to find out where those > templated friends hang out when not instantiated yet. > I think the whitelist is OK for the moment, once we get more of this kind of interface, we can re-evaluate. we could add walking them. In the meantime, could you update the comment, to say that this name is used as hidden friend name (only). > > Jakub > >
