[llvm-dev] Enable compiler warnings
Paul C. Anagnostopoulos via llvm-dev
llvm-dev at lists.llvm.org
Wed Sep 23 12:31:33 PDT 2020
I introduced a variable in a class that was not referenced anywhere, which was the error I had in yesterday's build. My compiler was silent. I'll try your example.
At 9/23/2020 03:18 PM, David Blaikie wrote:
>The latter should be sufficient.
>
>It's possible that the buildbot is using a different compiler with
>different warning implementations (& the LLVM CMake build does
>enable/disable certain warnings on a per-compiler basis because of
>inconsistencies in their implementations, or some of them being lower
>quality/buggy/etc).
>
>Have you tried introducing some fairly "obvious" code that should
>elicit a warning to see if your local build is identifying them?
>Missing a return statement in a non-void-returning function should
>probably be caught by nearly any compiler... (though maybe that's
>-Werror by default in some compilers, so might not be the best
>test)... not sure what the best example would be, unused variable,
>perhaps? (just add a local variable to a function with no use of that
>variable)
>
>On Wed, Sep 23, 2020 at 12:07 PM Paul C. Anagnostopoulos via llvm-dev
><llvm-dev at lists.llvm.org> wrote:
>>
>> Can someone tell me the magic CMake changes that I need to make so that the C++ compiler will display warnings and terminate? I broke the build yesterday because I had not seen a warning that then showed up in the build.
>>
>> I have these two options set in CMakeCache.txt:
>>
>> //Enable compiler warnings.
>> LLVM_ENABLE_WARNINGS:BOOL=ON
>>
>> //Fail and stop if a warning is triggered.
>> LLVM_ENABLE_WERROR:BOOL=ON
More information about the llvm-dev
mailing list