ninja-build/ninja

MSVC 2022 17.12.1 `configure.py --bootstrap` fails on `emhash/hash_table8.hpp`

Open

#2531 opened on Nov 24, 2024

View on GitHub
 (8 comments) (0 reactions) (0 assignees)C++ (10,194 stars) (1,544 forks)batch import
help wantedwindows

Description

warning C4456: declaration of 'slot' hides previous local declaration: https://github.com/ninja-build/ninja/blob/b40052cd6f3d7d801e035cd768b2462c06ff4ffd/src/third_party/emhash/hash_table8.hpp#L1329-L1340 https://github.com/ninja-build/ninja/blob/b40052cd6f3d7d801e035cd768b2462c06ff4ffd/src/third_party/emhash/hash_table8.hpp#L1364-L1375

full configure.py --bootstrap --platform msvc output:

H:\llvm\ninja>configure.py --bootstrap --platform msvc
bootstrapping ninja...
depfile_parser.cc
lexer.cc
build.cc
build_log.cc
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1340): error C2220: the following warning is treated as an error
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1340): warning C4456: declaration of 'slot' hides previous local declaration
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1329): note: see declaration of 'slot'
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1340): note: the template instantiation context (the oldest one first) is
H:\llvm\ninja\src\build_log.h(101): note: see reference to class template instantiation 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>' being compiled
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *
        ]
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1322): note: while compiling class template member function 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::size_type emhash8::HashMap<KeyT,ValueT,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::find_filled_bucket(const KeyT &,uint64_t) noexcept const'
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *
        ]
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(892): note: see the first reference to 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::find_filled_bucket' in 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::erase'
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *
        ]
.\src\build_log.cc(376): note: see the first reference to 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::erase' in 'BuildLog::Recompact'
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *
        ]
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1375): warning C4456: declaration of 'slot' hides previous local declaration
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1364): note: see declaration of 'slot'
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(1375): note: the template instantiation context (the oldest one first) is
.\src\build_log.cc(102): note: see reference to function template instantiation 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::iterator emhash8::HashMap<KeyT,ValueT,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::find<std::string>(const K &) noexcept' being compiled
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *,
            K=std::string
        ]
.\src\build_log.cc(102): note: see the first reference to 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::find' in 'BuildLog::RecordCommand'
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *
        ]
H:\llvm\ninja\src\third_party/emhash/hash_table8.hpp(556): note: see reference to function template instantiation 'emhash8::HashMap<StringPiece,V,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::size_type emhash8::HashMap<KeyT,ValueT,std::hash<StringPiece>,std::equal_to<KeyT>,std::allocator<std::pair<KeyT,ValueT>>,emhash8::DefaultPolicy>::find_filled_slot<K>(const K &) noexcept const' being compiled
        with
        [
            V=BuildLog::LogEntry *,
            KeyT=StringPiece,
            ValueT=BuildLog::LogEntry *,
            K=std::string
        ]
when running:  cl  /nologo /Zi /W4 /WX /wd4530 /wd4100 /wd4706 /wd4244 /wd4512 /wd4800 /wd4702 /wd4819 /wd4127 /wd4355 /wd4091 /GR- /Zc:__cplusplus /wd4267 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /D_HAS_EXCEPTIONS=0 /DNINJA_PYTHON="python3.exe" /FS /Ox /DNDEBUG /GL -I. -c .\src\build_log.cc /Fobuild\build_log.obj /Fdbuild\ninja.pdb
Traceback (most recent call last):
  File "H:\llvm\ninja\configure.py", line 558, in <module>
    objs += cxx(name, variables=cxxvariables)
            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\llvm\ninja\configure.py", line 297, in cxx
    return n.build(built(name + objext), 'cxx', src(name + '.cc'), **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "H:\llvm\ninja\configure.py", line 176, in build
    self._run_command(self._expand(cmd, local_vars))
  File "H:\llvm\ninja\configure.py", line 201, in _run_command
    subprocess.check_call(cmdline, shell=True)
  File "D:\Dev\Python3\Lib\subprocess.py", line 413, in check_call
    raise CalledProcessError(retcode, cmd)
subprocess.CalledProcessError: Command 'cl  /nologo /Zi /W4 /WX /wd4530 /wd4100 /wd4706 /wd4244 /wd4512 /wd4800 /wd4702 /wd4819 /wd4127 /wd4355 /wd4091 /GR- /Zc:__cplusplus /wd4267 /DNOMINMAX /D_CRT_SECURE_NO_WARNINGS /D_HAS_EXCEPTIONS=0 /DNINJA_PYTHON="python3.exe" /FS /Ox /DNDEBUG /GL -I. -c .\src\build_log.cc /Fobuild\build_log.obj /Fdbuild\ninja.pdb' returned non-zero exit status 2.

other warnings using LLVM clang-cl 19.1.4.

H:\llvm\ninja>configure.py --bootstrap --platform msvc
bootstrapping ninja...
.\src\disk_interface.cc(168,22): warning: cast from 'FARPROC' (aka 'long long (*)()') to 'FunctionType *' (aka 'unsigned char (*)()') converts to incompatible function type [-Wcast-function-type-mismatch]
  168 |     auto* func_ptr = reinterpret_cast<FunctionType*>(
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  169 |         ::GetProcAddress(ntdll_lib, "RtlAreLongPathsEnabled"));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from .\src\manifest_parser.cc:15:
In file included from .\src\manifest_parser.h:20:
D:\Program Files\Microsoft Visual Studio\2022\VC\Tools\MSVC\14.42.34433\include\memory(3302,9): warning: delete called on non-final 'ManifestParser' that has virtual functions but non-virtual destructor
      [-Wdelete-non-abstract-non-virtual-dtor]
 3302 |         delete _Ptr;
      |         ^
D:\Program Files\Microsoft Visual Studio\2022\VC\Tools\MSVC\14.42.34433\include\memory(3412,13): note: in instantiation of member function 'std::default_delete<ManifestParser>::operator()' requested here
 3412 |             _Mypair._Get_first()(_Mypair._Myval2);
      |             ^
.\src\manifest_parser.cc(30,17): note: in instantiation of member function 'std::unique_ptr<ManifestParser>::~unique_ptr' requested here
   30 | ManifestParser::ManifestParser(State* state, FileReader* file_reader,
      |                 ^
1 warning generated.
.\src\minidump-win32.cc(55,7): warning: cast from 'FARPROC' (aka 'long long (*)()') to 'MiniDumpWriteDumpFunc' (aka 'int (*)(void *, unsigned long, void *, _MINIDUMP_TYPE, _MINIDUMP_EXCEPTION_INFORMATION
      *const, _MINIDUMP_USER_STREAM_INFORMATION *const, _MINIDUMP_CALLBACK_INFORMATION *const)') converts to incompatible function type [-Wcast-function-type-mismatch]
   55 |       (MiniDumpWriteDumpFunc)GetProcAddress(dbghelp, "MiniDumpWriteDump");
      |       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from .\src\ninja.cc:39:
In file included from .\src\build.h:20:
D:\Program Files\Microsoft Visual Studio\2022\VC\Tools\MSVC\14.42.34433\include\memory(3302,9): warning: delete called on non-final 'ManifestParser' that has virtual functions but non-virtual destructor
      [-Wdelete-non-abstract-non-virtual-dtor]
 3302 |         delete _Ptr;
      |         ^
D:\Program Files\Microsoft Visual Studio\2022\VC\Tools\MSVC\14.42.34433\include\memory(3412,13): note: in instantiation of member function 'std::default_delete<ManifestParser>::operator()' requested here
 3412 |             _Mypair._Get_first()(_Mypair._Myval2);
      |             ^
.\src\manifest_parser.h(41,8): note: in instantiation of member function 'std::unique_ptr<ManifestParser>::~unique_ptr' requested here
   41 | struct ManifestParser : public Parser {
      |        ^
1 warning generated.

GCC 14.2 warnings:

H:\llvm\ninja>configure.py --bootstrap --platform mingw
bootstrapping ninja...
.\src\disk_interface.cc: In constructor 'RealDiskInterface::RealDiskInterface()':
.\src\disk_interface.cc:168:22: warning: cast between incompatible function types from 'FARPROC' {aka 'long long int (*)()'} to 'BOOLEAN (*)()' {aka 'unsigned char (*)()'} [-Wcast-function-type]
  168 |     auto* func_ptr = reinterpret_cast<FunctionType*>(
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  169 |         ::GetProcAddress(ntdll_lib, "RtlAreLongPathsEnabled"));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\src\util.cc: In function 'std::string GetLastErrorString()':
.\src\util.cc:547:69: warning: format '%d' expects argument of type 'int', but argument 4 has type 'DWORD' {aka 'long unsigned int'} [-Wformat=]
  547 |     snprintf(fallback_msg, sizeof(fallback_msg), "GetLastError() = %d", err);
      |                                                                    ~^   ~~~
      |                                                                     |   |
      |                                                                     int DWORD {aka long unsigned int}
      |                                                                    %ld
wrote build.ninja.

LLVM mingw 19.1.4 warnings:

H:\llvm\ninja>set CXX=D:\Dev\llvm-mingw\bin\clang++.exe

H:\llvm\ninja>configure.py --bootstrap --platform mingw
bootstrapping ninja...
.\src\disk_interface.cc:168:22: warning: cast from 'FARPROC' (aka 'long long (*)()') to 'FunctionType *' (aka 'unsigned char (*)()') converts to incompatible function type [-Wcast-function-type-mismatch]
  168 |     auto* func_ptr = reinterpret_cast<FunctionType*>(
      |                      ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  169 |         ::GetProcAddress(ntdll_lib, "RtlAreLongPathsEnabled"));
      |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.
In file included from .\src\manifest_parser.cc:15:
In file included from .\src/manifest_parser.h:18:
In file included from .\src/parser.h:18:
In file included from D:/Dev/llvm-mingw/include/c++/v1/string:647:
In file included from D:/Dev/llvm-mingw/include/c++/v1/string_view:941:
In file included from D:/Dev/llvm-mingw/include/c++/v1/algorithm:1842:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__algorithm/for_each.h:16:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__ranges/movable_box.h:21:
In file included from D:/Dev/llvm-mingw/include/c++/v1/optional:1294:
In file included from D:/Dev/llvm-mingw/include/c++/v1/memory:944:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__memory/inout_ptr.h:16:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__memory/shared_ptr.h:32:
D:/Dev/llvm-mingw/include/c++/v1/__memory/unique_ptr.h:80:5: warning: delete called on non-final 'ManifestParser' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
   80 |     delete __ptr;
      |     ^
D:/Dev/llvm-mingw/include/c++/v1/__memory/unique_ptr.h:292:7: note: in instantiation of member function 'std::default_delete<ManifestParser>::operator()' requested here
  292 |       __ptr_.second()(__tmp);
      |       ^
.\src\manifest_parser.cc:425:16: note: in instantiation of member function 'std::unique_ptr<ManifestParser>::reset' requested here
  425 |     subparser_.reset(new ManifestParser(state_, file_reader_, options_));
      |                ^
1 warning generated.
.\src\util.cc:547:73: warning: format specifies type 'int' but the argument has type 'DWORD' (aka 'unsigned long') [-Wformat]
  547 |     snprintf(fallback_msg, sizeof(fallback_msg), "GetLastError() = %d", err);
      |                                                                    ~~   ^~~
      |                                                                    %lu
1 warning generated.
In file included from .\src\ninja.cc:21:
In file included from D:/Dev/llvm-mingw/include/c++/v1/algorithm:1842:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__algorithm/for_each.h:16:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__ranges/movable_box.h:21:
In file included from D:/Dev/llvm-mingw/include/c++/v1/optional:1294:
In file included from D:/Dev/llvm-mingw/include/c++/v1/memory:944:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__memory/inout_ptr.h:16:
In file included from D:/Dev/llvm-mingw/include/c++/v1/__memory/shared_ptr.h:32:
D:/Dev/llvm-mingw/include/c++/v1/__memory/unique_ptr.h:80:5: warning: delete called on non-final 'ManifestParser' that has virtual functions but non-virtual destructor [-Wdelete-non-abstract-non-virtual-dtor]
   80 |     delete __ptr;
      |     ^
D:/Dev/llvm-mingw/include/c++/v1/__memory/unique_ptr.h:292:7: note: in instantiation of member function 'std::default_delete<ManifestParser>::operator()' requested here
  292 |       __ptr_.second()(__tmp);
      |       ^
D:/Dev/llvm-mingw/include/c++/v1/__memory/unique_ptr.h:261:71: note: in instantiation of member function 'std::unique_ptr<ManifestParser>::reset' requested here
  261 |   _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
      |                                                                       ^
.\src/manifest_parser.h:41:8: note: in instantiation of member function 'std::unique_ptr<ManifestParser>::~unique_ptr' requested here
   41 | struct ManifestParser : public Parser {
      |        ^
1 warning generated.
wrote build.ninja.

Contributor guide