[squid-dev] bizarre build behaviour from PoolingAllocator on OpenBSD/clang

Francesco Chemolli gkinkie at gmail.com
Sun Aug 15 18:51:06 UTC 2021


Hi all,
  I'm looking into OpenBSD compatibility for trunk, and there's a
strange behaviour at build time on  OpenBSD (6.9) / clang (10.0.1)

When building src/log/access.log.cc, build fails with these errors:

------------------ begin quote -----------
    static_assert((is_same<value_type, typename
allocator_type::value_type>::value),
    ^
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
access_log.cc:66:26: note: in instantiation of template class
'std::__1::unordered_map<SBuf, unsigned long long,
std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >'
requested here
static HeaderValueCounts TheViaCounts;
                         ^
access_log.cc:460:25: error: type 'HeaderValueCounts' (aka
'unordered_map<SBuf, unsigned long long, hash<SBuf>, equal_to<SBuf>,
PoolingAllocator<pair<SBuf, unsigned long long> > >') does not provide
a subscript operator
    ++TheForwardedCounts[key];
      ~~~~~~~~~~~~~~~~~~^~~~
access_log.cc:467:24: error: invalid range expression of type 'const
std::__1::unordered_map<SBuf, unsigned long long,
std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >'; no
viable 'begin' function available
    for (const auto &i : counts)
                       ^ ~~~~~~
/usr/include/c++/v1/initializer_list:99:1: note: candidate template
ignored: could not match 'initializer_list' against 'unordered_map'
begin(initializer_list<_Ep> __il) _NOEXCEPT
^
/usr/include/c++/v1/iterator:1753:1: note: candidate template ignored:
could not match '_Tp [_Np]' against 'const
std::__1::unordered_map<SBuf, unsigned long long,
std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >'
begin(_Tp (&__array)[_Np])
^
/usr/include/c++/v1/iterator:1771:1: note: candidate template ignored:
substitution failure [with _Cp = const std::__1::unordered_map<SBuf,
unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >]: no
member named 'begin' in 'std::__1::unordered_map<SBuf, unsigned long
long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >'
begin(_Cp& __c) -> decltype(__c.begin())
^                               ~~~~~
/usr/include/c++/v1/iterator:1779:1: note: candidate template ignored:
substitution failure [with _Cp = std::__1::unordered_map<SBuf,
unsigned long long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >]: no
member named 'begin' in 'std::__1::unordered_map<SBuf, unsigned long
long, std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >'
begin(const _Cp& __c) -> decltype(__c.begin())
^                                     ~~~~~
access_log.cc:489:24: error: no member named 'clear' in
'std::__1::unordered_map<SBuf, unsigned long long,
std::__1::hash<SBuf>, std::__1::equal_to<SBuf>,
PoolingAllocator<std::__1::pair<SBuf, unsigned long long> > >'
    TheForwardedCounts.clear();
    ~~~~~~~~~~~~~~~~~~ ^
------------------ end quote -----------

But then, removing the reference to PoolingAllocator in the definition
of HeaderValueCounts, everything works.
"""
using HeaderValueCounts = std::unordered_map<SBuf, uint64_t,
std::hash<SBuf>, std::equal_to<SBuf> >;
"""

I'm puzzled: I wouldn't expect this to be an OS-specific failure. Any clue?



-- 
    Francesco


More information about the squid-dev mailing list