]> git.ipfire.org Git - thirdparty/squid.git/commit
Optimize RefCount comparison with raw pointers (#1200)
authorsameer-here <76567789+sameer-here@users.noreply.github.com>
Wed, 7 Dec 2022 17:27:47 +0000 (17:27 +0000)
committerSquid Anubis <squid-anubis@squid-cache.org>
Wed, 7 Dec 2022 17:27:56 +0000 (17:27 +0000)
commit56b2587856ccd0198e488d1f74633c29e20fabd7
treecc0ae9c640a19192af5faa943e750e0311c79c55
parentbcd05a84ce543a50c354435e58ad6850f29e59e8
Optimize RefCount comparison with raw pointers (#1200)

GCC v12 and Clang v12 tests show that compilers cannot avoid creating
temporaries when comparing RefCount objects with arbitrary pointers.

Also fixes (not yet supported) C++20 build. C++20 automatically reverses
equality comparisons, triggering an ambiguity:

    src/esi/Esi.cc:1920:26: error: ambiguous overload for 'operator=='
        (operand types are 'ESISegment::Pointer' {aka
        'RefCount<ESISegment>'} and std::nullptr_t)
        assert (output->next == nullptr);

    src/esi/Esi.cc:77:6: note: candidate: 'bool operator==(const
        ESIElement*, const Pointer&)' (reversed)

    src/base/RefCount.h:82:10: note: candidate: 'bool
        RefCount<C>::operator==(const RefCount<C>&) const [with C =
        ESISegment]'
src/base/RefCount.h