Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. How to suppress -Wreorder warning
QtWS25 Last Chance

How to suppress -Wreorder warning

Scheduled Pinned Locked Moved General and Desktop
7 Posts 2 Posters 5.1k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    rastaxe
    wrote on last edited by
    #1

    I am writing a Qt5 desktop application including the openni library (Linux platform, 32 bit) . When I build the project I have a lot of warnings (-Wno-unknown-pragmas, -Wreorder) and I would like to suppress them.
    Adding "QMAKE_CXXFLAGS_WARN_ON += -Wno-unknown-pragmas" in the .pro file, allows to suppress this kind of warning. But I am not able to suppress the -Wreorder.
    Any suggestions?

    1 Reply Last reply
    0
    • B Offline
      B Offline
      bestel74
      wrote on last edited by
      #2

      #pragma GCC diagnostic ignored "-Wformat"

      Note that in general the use of pragmas is not recommended.

      sources :
      http://gcc.gnu.org/onlinedocs/gcc/Pragmas.html
      https://gcc.gnu.org/onlinedocs/gcc/Diagnostic-Pragmas.html#Diagnostic-Pragmas

      1 Reply Last reply
      0
      • R Offline
        R Offline
        rastaxe
        wrote on last edited by
        #3

        The use of #pragma does not work, because it seems that Qt automatically add -Wall as option to the compiler.

        1 Reply Last reply
        0
        • B Offline
          B Offline
          bestel74
          wrote on last edited by
          #4

          Remove the flag in your .pro, add :

          @QMAKE_CXXFLAGS -= -Wall@

          1 Reply Last reply
          0
          • R Offline
            R Offline
            rastaxe
            wrote on last edited by
            #5

            I added "QMAKE_CXXFLAGS_WARN_ON -= -Wall" and of course it worked. But I don't want to disable all the warnings.

            1 Reply Last reply
            0
            • B Offline
              B Offline
              bestel74
              wrote on last edited by
              #6

              You can suppress all warning, and add only the warnings you want to :)

              BTW I don't know why
              @#pragma GCC diagnostic ignored “-Wformat”@

              didn't work, because the compiler "read" this line AFTER -Wall ...

              Sorry to say that because it won't help you so much, but if I were you, I wouldn't suppress the Wreorder warning... Can't you just reorder ? I think it's more safe ! It's very hard to debug !

              1 Reply Last reply
              0
              • R Offline
                R Offline
                rastaxe
                wrote on last edited by
                #7

                The problem is that all these warnings belongs to the openni library, so I don't want to modify it.
                However, I have disabled all the warnings and then re-enabled the others.
                Thanks a lot!

                1 Reply Last reply
                0

                • Login

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • Users
                • Groups
                • Search
                • Get Qt Extensions
                • Unsolved