[PATCH] D99825: [cmake] Enable -Werror=return-type for clang

David Blaikie via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 6 13:02:20 PDT 2021


dblaikie added a comment.

In D99825#2671982 <https://reviews.llvm.org/D99825#2671982>, @kastiglione wrote:

> 1. I've updated the summary to include wording from the original diff D98224 <https://reviews.llvm.org/D98224> which points out that `-Werror=return-type` is used in libcxx, libcxxabi, and libunwind.

Ah, thanks for the prior context - sorry I missed that review.

> 2. Warnings have a spectrum of severity, `-Wreturn-type` is one of the most severe, but turning on `-Werror` for more mundane warnings would be a deal breaker for some projects. I think it's more reasonable to turn errors on individually, rather than require a codebase to be all or nothing.

Generally we try pretty hard to be -Werror clean for clang at least (& some folks do so for gcc too).

> 3. There are already other `-Werror=...` in this same file, so there is precedent.

The two I see are `date-time` and `unguarded-availability-new` which I'd be similarly a bit suspicious of, but I guess they're constraint enforcement which is a bit different from warnings.

> Are there downsides to this? I don't see them, I only seem benefits.

I'd rather not get into the territory of classifying different warnings - and encourage people to turn on -Werror generally, as many buildbots do.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D99825/new/

https://reviews.llvm.org/D99825



More information about the llvm-commits mailing list