From: Edwin Rodriguez Date: Thu, 7 Aug 2025 20:28:44 +0000 (-0400) Subject: test/osd: Suppress subobject-linkage warning in SelectMappingAndLayers class X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=refs%2Fpull%2F64973%2Fhead;p=ceph.git test/osd: Suppress subobject-linkage warning in SelectMappingAndLayers class Change SelectMapping and SelectLayers definitions to use non-static arrays of strings. SelectMappingAndLayers::sma and SelectMappingAndLayers::sly have internal storage duration, because it is a non-template, non-inline, non-extern const-qualified variable. As a consequence, in each translation unit sma and sly is a different object. And because ProgramOptionSelector takes a reference as template argument, then ProgramOptionSelector<...> are different specializations of ProgramOptionSelector in different translation units, because the template parameter references different objects in each. Then, if you include the header in two different translation units, the program will have undefined behavior, because the definitions of SelectMapping violates the one-definition rule as they are, roughly said, not semantically identical. The compiler has no way to decide whether SelectMapping is supposed to have ProgramOptionSelector or ProgramOptionSelector as base class (where value1 and value2 are invented names for the two instances of io_sequence::tester::lrc::mapping_layer_array_sizes in the different translation units). Fixes: https://tracker.ceph.com/issues/72482 Signed-off-by: Edwin Rodriguez --- diff --git a/src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h b/src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h index d12e98416f72..50b9f9ac36cd 100644 --- a/src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h +++ b/src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h @@ -243,7 +243,7 @@ namespace lrc { // matches what index will be chosen from the layers array. inline static constexpr int mapping_layer_array_sizes = 15; -inline static std::array mapping_choices = {{ +inline std::array mapping_choices = {{ "_DD", "_DDD", "_DDDD", @@ -261,7 +261,7 @@ inline static std::array mapping_choices "_D_D_DDDD", }}; -inline static std::array layer_choices = {{ +inline std::array layer_choices = {{ "[[\"cDD\",\"\"]]", "[[\"cDDD\",\"\"]]", "[[\"cDDDD\",\"\"]]",