[PATCH] D58154: Add support for -fpermissive.

Richard Smith - zygoloid via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Mar 4 14:48:28 PST 2019


rsmith added a comment.

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.

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".

In D58154#1417358 <https://reviews.llvm.org/D58154#1417358>, @jyknight wrote:

> Hm -- in GCC, -fpermissive has nothing at all to do with -pedantic/-pedantic-errors, but I suppose it should be fine to do this way.


Yeah, I don't think it's likely that the restriction on combining those two flags will cause problems in practice.

[I don't think the behavior of `-fpermissive -pedantic-errors` (converting all error-by-default extensions to warnings and converting all non-error-by-default extensions to errors) was a carefully-considered design choice on GCC's part; rather, I think it's just the emergent behavior of the way they happen to deal with extension diagnostics. As a general design point for Clang, downgrading a diagnostic from error-by-default to warning-by-default shouldn't be a breaking change, but could be if we followed GCC here and someone actually used that flag combination. If someone actually hits the diagnostic for combining these two flags and can provide some kind of justification for wanting that behavior, we could reconsider.]


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