Sylwester Lachiewicz created THRIFT-6250:
--------------------------------------------

             Summary: Clean up the warnings in the MSVC CI build
                 Key: THRIFT-6250
                 URL: https://issues.apache.org/jira/browse/THRIFT-6250
             Project: Thrift
          Issue Type: Improvement
          Components: C++ - Library, C++ - Compiler, Build Process
            Reporter: Sylwester Lachiewicz


The MSVC CI job ([example run on 
master|https://github.com/apache/thrift/actions/runs/34762947299]) prints about 
400 warning lines. Apart from the AI_V4MAPPED redefinition tracked in 
[THRIFT-6249|https://issues.apache.org/jira/browse/THRIFT-6249], they fall into 
these families, none of which is a bug in the code being compiled, and each has 
a small in-tree fix.

h3. Fixed by the linked PR

* *C4005 INT8_MIN and the other stdint limit macros, 9 per run*, in the 
flex-generated {{thriftl.cc}} ({{parse.vcxproj}}). Flex's skeleton defines them 
itself when {{__STDC_VERSION__}} is not C99, which is the case for a C++ 
compile, and guards each with {{#ifndef}}; MSVC's {{stdint.h}}, included later, 
then redefines them. A {{%top}} block in 
[compiler/cpp/src/thrift/thriftl.ll|https://github.com/apache/thrift/blob/master/compiler/cpp/src/thrift/thriftl.ll]
 that includes {{<stdint.h>}} before the skeleton makes the guards skip.
* *D9002 ignoring unknown option '-std=c++11', 4 per run*. 
[lib/py/setup.py|https://github.com/apache/thrift/blob/master/lib/py/setup.py] 
passes the GCC flag to every compiler, including cl.exe.
* *CMake Warning (dev): Policy CMP0144 is not set, 3 per run*. The build passes 
{{LIBEVENT_ROOT}} and CMake 3.27+ warns that {{find_package}} ignores 
upper-case {{<PACKAGENAME>_ROOT}} variables until the policy is NEW. 
[CMakeLists.txt|https://github.com/apache/thrift/blob/master/CMakeLists.txt] 
already sets CMP0074 the same way.
* *CMake Warning (dev): package name mismatch in FindClangTools, 3 per run*. 
[build/cmake/FindClangTools.cmake|https://github.com/apache/thrift/blob/master/build/cmake/FindClangTools.cmake]
 calls {{find_package_handle_standard_args}} for {{clang-tidy}}, 
{{clang-apply-replacements}} and {{run-clang-tidy}} from a module named 
ClangTools; {{FPHSA_NAME_MISMATCHED}} declares that intentional.
* *C4858 discarding return value, 1 per run*, at 
[lib/cpp/test/SecurityTest.cpp:297|https://github.com/apache/thrift/blob/master/lib/cpp/test/SecurityTest.cpp#L297]:
 the test constructs a shared_ptr only to check that the constructor throws.

h3. Left out, with the reason

* *LNK4098 defaultlib 'LIBCMT' conflicts, 5 per run*, on the five targets that 
link libevent (TNonblockingServerTest, TNonblockingSSLServerTest, TestClient, 
TestServer, processor_test). libevent 2.1.8's {{Makefile.nmake}} sets no 
runtime flag, so {{cl}} defaults to {{/MT}}, while Thrift builds {{/MD}}. The 
fix is {{SET CL=/MD}} in 
[build/appveyor/build-libevent.bat|https://github.com/apache/thrift/blob/master/build/appveyor/build-libevent.bat]
 before the {{nmake}} call, which changes the Docker image and therefore waits 
for [PR #3844|https://github.com/apache/thrift/pull/3844] to land first.
* *C4244 at protocol.tcc:995 (Py_ssize_t to int), 1 per run*. [PR 
#3594|https://github.com/apache/thrift/pull/3594] and [PR 
#3596|https://github.com/apache/thrift/pull/3596] (THRIFT-6069) rewrite that 
file; not worth a conflict.
* *CS0114 'Xception.Message' hides inherited member, 2 per run*, in the 
generated netstd code for {{ThriftTest.thrift}}: the IDL names a field 
{{message}} on an exception. A generator change, separate ticket if wanted.
* *C4244 in libevent's own sources, 4 per image build*. Third-party code, only 
visible when the image is rebuilt.
* *{{[WARNING:...]}} lines from the Thrift compiler* while generating 
{{DebugProtoTest.thrift}} and {{ThriftTest.thrift}}: expected output of those 
test inputs.

_This issue was created with AI assistance._




--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to