Hi,
On 05/05/2015 11:24 PM, Paolo Carlini wrote:
Hi,
per the audit trail, this issue appears to boil down to two separate
issues:
- The warning doesn't appear universally useful, thus it would be nice
to give it a name in order to enable disabling it.
- As shown by the testcase, sometimes the wording is misleading: it
talks about 'anonymous namespace', where, as clarified by Jason in the
trail, the issue is really about a type with no linkage, no namespace
involved.
- The former is easy done, I picked: -Wsubobject-linkage. Makes sense?
- The latter is a little more tricky, because it doesn't seem always
easy to tell one case from the other, in particular when templates are
involved (eg, g++.dg/warn/anonymous-namespace-3.C) and the linkage
issue involves template arguments. Given that the warning doesn't seem
terribly important (as another data point, clang doesn't have it), so
far I have conditionals which reliably figure out cases of anonymous
namespace and cases of no linkage (per the testcase at issue, for
example) and otherwise fall back to an 'or' wording. I hope the
improvement is good enough. Alternately, I suppose the warning could
use a completely different, more generic, wording, but in that case
testcases like anonymous-namespace-3.C will need adjustment.
Any feedback on this?
https://gcc.gnu.org/ml/gcc-patches/2015-05/msg00370.html
Thanks!
Paolo.