[committed] libstdc++: Replace operator>>(istream&, char*) [LWG 2499]

Jonathan Wakely jwakely@redhat.com
Thu Aug 6 15:05:20 GMT 2020


On 06/08/20 08:56 -0600, Martin Sebor via Libstdc++ wrote:
>For this specific use case, I saw __istream_extract defined
>as an ordinary (non-template) function in a .tcc file in
>the patch so I thought it was out of line.  If it's inline

It's overloaded. One is a function template defined inline, the other
is a non-inline function defined in the library.

>or if it's a template the only workaround I can think of
>to retain the warning is to have it make a call to (no-op)
>function with the attribute that is not inlined.  It's too
>bad there is no attribute to tell the expander to avoid
>emitting such a function (which would be the equivalent of
>the idea I outlined in my second paragraph above).

That will still fail to warn because of -Wsystem-headers.

Attempting to use attributes here achieves absolutely nothing for the
problem scenarios I was concerned about.

The only case where it helps is passing a null pointer or a pointer to
a zero-sized buffer to operator>> and not optimising. All other
problematic cases fail to warn, and it's those other cases where a
warning would be helpful.




More information about the Gcc-patches mailing list