]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ci.git/commit
RGW: make SSTR macro safe against variable name collisions
authorOguzhan Ozmen <oozmen@bloomberg.net>
Sat, 8 Nov 2025 19:28:19 +0000 (19:28 +0000)
committerOguzhan Ozmen <oozmen@bloomberg.net>
Fri, 13 Feb 2026 03:47:49 +0000 (03:47 +0000)
commitc630f339c4ff708fe4a14df61eaa9a8f72725f61
tree2abb3c2f72a37709bcc6251ca7711288ea5c6741
parent40d8bc0560ed50f6ca86f3067f49b37705803881
RGW: make SSTR macro safe against variable name collisions

The original SSTR macro defined a local variable `std::stringstream ss`
inside its expansion. When an expression that used a variable named `ss`
is passed to this macro, it led to name shadowing and unexpected results.

  Example:
    std::stringstream ss;
    ss << "aaa";
    auto result = SSTR("this is ss=" << ss.str());

  Actual result:
    "this is ss=this is ss="
  Expected result:
    "this is ss=aaa"

This change rewrites the macro to construct an unnamed temporary to
avoid any name collision.

Signed-off-by: Oguzhan Ozmen <oozmen@bloomberg.net>
src/rgw/driver/rados/rgw_sync_trace.h
src/test/rgw/CMakeLists.txt
src/test/rgw/test_rgw_sync_trace.cc [new file with mode: 0644]