[clang-tools-extra] 9791416 - Silence a "logical operation on address of string constant" via CMake instead.

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Tue Jul 21 05:43:56 PDT 2020


On Mon, Jul 20, 2020 at 5:44 PM David Blaikie <dblaikie at gmail.com> wrote:
>
> Should the warning be disabled for LLVM overall, rather than only for
> this subproject? (& be good tohave some details in the commit at least
> of why this warning is being disabled - how it is noisy/unhelpful/etc)

Thank you for pointing out the lack of details in the commit message,
sorry about that! I didn't think it should be disabled for LLVM
overall because the issue was highly local to that particular file.
Effectively, there's a #define/#include/#undef pattern in that file
where some of the macro expansions would expand out to "string
literal" == nullptr, which MSVC would complain about. Replacing the
macro expansion with different code caused other diagnostics, so this
was an expedient solution. I think if we found a second place where we
need to disable the diagnostic, it might make sense to disable it
globally at that point, but I wouldn't be strongly opposed to
silencing it globally if someone felt strongly.

~Aaron

>
> On Sun, Jul 19, 2020 at 8:20 AM Aaron Ballman via cfe-commits
> <cfe-commits at lists.llvm.org> wrote:
> >
> >
> > Author: Aaron Ballman
> > Date: 2020-07-19T11:19:48-04:00
> > New Revision: 97914164f8454e745219566d58479b5762cccd51
> >
> > URL: https://github.com/llvm/llvm-project/commit/97914164f8454e745219566d58479b5762cccd51
> > DIFF: https://github.com/llvm/llvm-project/commit/97914164f8454e745219566d58479b5762cccd51.diff
> >
> > LOG: Silence a "logical operation on address of string constant" via CMake instead.
> >
> > Added:
> >
> >
> > Modified:
> >     clang-tools-extra/clangd/CMakeLists.txt
> >
> > Removed:
> >
> >
> >
> > ################################################################################
> > diff  --git a/clang-tools-extra/clangd/CMakeLists.txt b/clang-tools-extra/clangd/CMakeLists.txt
> > index b3002b1d5698..8db6656e5291 100644
> > --- a/clang-tools-extra/clangd/CMakeLists.txt
> > +++ b/clang-tools-extra/clangd/CMakeLists.txt
> > @@ -28,6 +28,10 @@ set(LLVM_LINK_COMPONENTS
> >    Option
> >    )
> >
> > +if(MSVC AND NOT CLANG_CL)
> > + set_source_files_properties(CompileCommands.cpp PROPERTIES COMPILE_FLAGS -wd4130) # disables C4130: logical operation on address of string constant
> > +endif()
> > +
> >  add_clang_library(clangDaemon
> >    AST.cpp
> >    ClangdLSPServer.cpp
> >
> >
> >
> > _______________________________________________
> > cfe-commits mailing list
> > cfe-commits at lists.llvm.org
> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits


More information about the cfe-commits mailing list