[PATCH] D58154: Add support for -fpermissive.

Aaron Ballman via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Mar 5 07:23:33 PST 2019


aaron.ballman added a comment.

In D58154#1417474 <https://reviews.llvm.org/D58154#1417474>, @rsmith wrote:

> In D58154#1417363 <https://reviews.llvm.org/D58154#1417363>, @aaron.ballman wrote:
>
> > I'm not super keen on supporting -fpermissive --  what is the impetus for supporting this? Is it just for GCC compatibility?
>
>
> Yes, exactly that -- this is to improve our drop-in compatibility with GCC. See http://llvm.org/PR40670 for an example user request for this.


I don't think we should support -fpermissive. I'm sure that we *can*, but I don't think that we *should*. My strong preference is to close that report as WONTFIX.

> In much the same way that `-w` can be used to mean "I just want this (crufty old, but presumed correct) code to compile; don't bother me with warnings about it", `-fpermissive` (and in particular `-fpermissive -w`) can be used to mean "I just want this (crufty, old, and relying on compiler extensions, but presumably correct) code to compile; don't bother me with complaints that it's technically ill-formed".

I think -fpermssive is actively harmful to support because its use cannot be limited to old code bases to allow them to continue to limp along in a broken state. Naive users will turn it on simply because it gets their code to compile. Also, there is a big difference between -w and -fpermissive; the former is reasonable because of false positive diagnostics, but the latter simply hides utterly broken code that may or may not happen to "work". This flag is so toxic that our static analyzer won't attempt to analyze code relying on -fpermissive to compile, so there is out-of-tree cost to Clang supporting this.

As much as I usually love improving compiler compatibility, I don't think compatibility is sufficiently compelling for this feature. Personally, I think supporting -fpermissive is about as compelling as trying to be bug-for-bug compatible with another compiler (though, it is marginally better because this is at least a documented compiler flag).


Repository:
  rC Clang

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

https://reviews.llvm.org/D58154





More information about the cfe-commits mailing list