Open mmjkelso opened 9 months ago
Same noticed on Ubuntu 22.04 LTE.
Compilers:
gcc --version gcc (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
g++ --version g++ (Ubuntu 11.4.0-1ubuntu1~22.04) 11.4.0 Copyright (C) 2021 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Warnings attached. ProtobufWarnings.txt
What version of protobuf and what language are you using? Version: v25.1 (actually a bit after, main from 20231123. Relevant code hasn't changed since then) Language: C++
What operating system (Linux, Windows, ...) and version? Windows 11 Pro 22H2
What runtime / compiler are you using (e.g., python version or gcc version) MS Visual Studio 17.8.0 (tool version 14.37.32822)
What did you do? Compile something that makes use of include/google/protobuf/map.h
What did you expect to see Warning-free compilation
What did you see instead? Warnings from Abseil : include\absl\log\internal\check_op.h(340,1): warning C4018: '>=': signed/unsigned mismatch This is from an Abseil macro that generates Check_GEImpl(), used in map.h
Anything else we should know about your project / environment
map.h
line 1041 (in current main) invokesABSL_DCHECK_GE(new_num_buckets, kMinTableSize);
the first arg is
map_index_t
which resolves touint32_t
, whereas the second is defined at line 528 asenum { kMinTableSize = 16 / sizeof(void*) };
I'm guess MSVC is choosing a signed type for the enum which is causing the problem. Changing it to
enum : unsigned int { kMinTableSize = 16 / sizeof(void*) };
makes the warnings go away