In gcc, how to mute the -fpermissive warning?

后端 未结 2 1317
眼角桃花
眼角桃花 2020-12-25 12:53

I am including a file from a third-party library that raises an error that can be downgraded to a warning with -fpermissive. But because I do not want to \"poll

相关标签:
2条回答
  • 2020-12-25 13:29

    It's maybe a bit late for this, but one of these ought to do what you wanted:

    #pragma GCC diagnostic ignored "-fpermissive"
    

    or

    #pragma GCC diagnostic ignored "-pedantic"
    

    "ignored" is how you squelch a diagnostic entirely, and the inverse of -fpermissive is -pedantic, for historical reasons.

    0 讨论(0)
  • 2020-12-25 13:35

    tldr: You cannot turn off the fpermissive output after GCC 4.7.


    Just posting this here so it has more visibility: unfortunately, zwol's answer (while well-intentioned, and potentially helpful to those with older GCC versions) does not work for more recent versions of GCC. From GCC 4.8 and beyond, you cannot turn off the fpermissive output. o11c in his comment to the OP helpfully provides the following bug which tracks this:

    https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81787

    Note that it is in the state "RESOLVED INVALID", so the inability to turn it off is the expected behavior and there are no plans to change it.

    0 讨论(0)
提交回复
热议问题