[cfe-dev] Different Clang-Tidy results on Linux vs Windows

Jonas Toth via cfe-dev cfe-dev at lists.llvm.org
Thu Jan 17 12:45:29 PST 2019


Hey Hugo,

that is weird, but the default configurations could differ.
`modernize-use-auto` has a feature that disables the replacements if the
type (e.g. `bool`) is shorter/same length as `auto`.
Could you please check if that for some reason interfered?

Best, Jonas

Am 16.01.19 um 19:13 schrieb Hugo lindström via cfe-dev:
> Greetings! 
>
> I'm using CMake and the CXX_CLANG_TIDY property to enable Clang-Tidy
> on Linux (GCC/Clang) and Windows (MSVC).  
>
> I use these lines to demo that I get different results on the platforms:
> constTU8* comp_ptr = static_cast<constTU8*>(buf_ptr);
> constTU8* t = NULL;
> Using Ninja and MSVC on Windows, Clang-Tidy modernize only reports
>
> |C:\Zebra\llvm-demo\build-win\..\src\aligned_buffer.cc:7:18: warning:
> use nullptr [modernize-use-nullptr] const TU8* t = NULL; ^~~~~ nullptr|
> Using Make and GCC on Linux, Clang-Tidy modernize reports
> |/tmp/workspace/llvm-demo/src/aligned_buffer.cc:6:9: warning: use auto
> when initializing with a cast to avoid duplicating the type name
> [modernize-use-auto] const TU8* comp_ptr = static_cast<const
> TU8*>(buf_ptr); ^~~~ auto|
> |
> |/tmp/workspace/llvm-demo/src/aligned_buffer.cc:7:18: warning: use
> nullptr [modernize-use-nullptr] const TU8* t = NULL; ^~~~~ nullptr||
>
> Both platforms have clang-tidy-6.0 and CMake 3.13
>
> Demo project: https://github.com/hugolm84/llvm-demo
>
> Is this expected, or do I do something wrong? I thought the clang-tidy
> binary would do the same checks on any platform it can run on?
> Can the compiler flags have anything to do with this? I use
>
>     target_compile_options(${PROJECT_NAME}
>         PRIVATE
>             $<$<OR:$<CXX_COMPILER_ID:Clang>,$<CXX_COMPILER_ID:GNU>>:
>                 $<$<CONFIG:Debug>:-O0 -Wall -Wextra>>
>             $<$<CXX_COMPILER_ID:MSVC>:
>                 $<$<CONFIG:Debug>:/Od /W4 /Zi>>
>     )
>
>
>
> Thanks in advance!
>
> Ps. This is my first post to the mailing list, please forgive me if
> the format is off or if this is the wrong forum.
>
> Best
>
> _______________________________________________
> cfe-dev mailing list
> cfe-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20190117/df6e14e9/attachment.html>


More information about the cfe-dev mailing list