Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

reporters: silence -Wsubobject-linkage #2794

Merged

Conversation

timblechmann
Copy link
Contributor

gcc emits Wsubobject-linkage, because the the publicly visible TablePrinter contains ColumnInfo, which is part of an anonymous namespace

Description

path/to/src/catch2/reporters/catch_reporter_console.cpp:296:7: warning: ‘Catch::TablePrinter’ has a field ‘Catch::TablePrinter::m_columnInfos’ whose type uses the anonymous namespace [-Wsubobject-linkage]
  296 | class TablePrinter {
      |       ^~~~~~~~~~~~

gcc emits `Wsubobject-linkage`, because the the publicly visible
`TablePrinter` contains `ColumnInfo`, which is part of an anonymous
namespace
Copy link

codecov bot commented Jan 10, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (863c662) 91.37% compared to head (952d094) 91.37%.

Additional details and impacted files
@@           Coverage Diff           @@
##            devel    #2794   +/-   ##
=======================================
  Coverage   91.37%   91.37%           
=======================================
  Files         198      198           
  Lines        8297     8297           
=======================================
  Hits         7581     7581           
  Misses        716      716           

@horenmar
Copy link
Member

What GCC versions do you see this with? I tried adding the flag locally and 11.4.0 does not warn about the current code.

@timblechmann
Copy link
Contributor Author

i'm seeing this with gcc-13 (i could assume that unity builds / lto may also affect this warning being emitted).

as a rule of thumb a struct that's not in an anonymous namespace should not contain any members that are defined in an anonymous namespace

@horenmar horenmar merged commit 597ce12 into catchorg:devel Jan 15, 2024
74 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants