]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commit
test/osd: Suppress subobject-linkage warning in SelectMappingAndLayers class
authorEdwin Rodriguez <edwin.rodriguez1@ibm.com>
Thu, 7 Aug 2025 20:28:44 +0000 (16:28 -0400)
committerEdwin Rodriguez <edwin.rodriguez1@ibm.com>
Tue, 26 Aug 2025 19:55:30 +0000 (15:55 -0400)
commit4ce1649001e8e2820022de8c2c122792b00d75fe
treeaa1b0f11111456ff4208dd3aaac8cc5b77f1f9d8
parentfb8387ae16dc4c4f7ece339ce6b3fd7be3883317
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<value1> or
ProgramOptionSelector<value2> 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 <edwin.rodriguez1@ibm.com>
src/test/osd/ceph_test_rados_io_sequence/ceph_test_rados_io_sequence.h