Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Is using `QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wwarning") QT_WARNING_POP` in the source file an appropriate way to disable warnings?
Forum Updated to NodeBB v4.3 + New Features

Is using `QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wwarning") QT_WARNING_POP` in the source file an appropriate way to disable warnings?

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
5 Posts 3 Posters 163 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.
  • N Offline
    N Offline
    novum
    wrote last edited by
    #1

    I use the following command to configure Qt.

    ../configure -prefix $HOME/.local/Qt6 -make examples -make tests -release -optimize-size -shared -skip qt5compat -skip qtdoc \
    -skip qtwebengine -no-feature-androiddeployqt -no-feature-qdoc  -system-zlib -system-sqlite -openssl-linked -developer-build --\
    -DCMAKE_PREFIX_PATH="$HOME/.local/sqlite;$HOME/.local/openssl" -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF -DQT_BUILD_TESTS_BY_DEFAULT=OFF
    

    When building Qt sources,I get warnings treaded as errors.

    To allow specific types of warnings, I add the following code to the source file.

    QT_WARNING_PUSH
    QT_WARNING_DISABLE_GCC("-Warray-bounds")
    ...
    code
    ...
    QT_WARNING_POP
    

    Is this an appropriate way to disable warnings?

    JonBJ Christian EhrlicherC 2 Replies Last reply
    0
    • N novum

      I use the following command to configure Qt.

      ../configure -prefix $HOME/.local/Qt6 -make examples -make tests -release -optimize-size -shared -skip qt5compat -skip qtdoc \
      -skip qtwebengine -no-feature-androiddeployqt -no-feature-qdoc  -system-zlib -system-sqlite -openssl-linked -developer-build --\
      -DCMAKE_PREFIX_PATH="$HOME/.local/sqlite;$HOME/.local/openssl" -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF -DQT_BUILD_TESTS_BY_DEFAULT=OFF
      

      When building Qt sources,I get warnings treaded as errors.

      To allow specific types of warnings, I add the following code to the source file.

      QT_WARNING_PUSH
      QT_WARNING_DISABLE_GCC("-Warray-bounds")
      ...
      code
      ...
      QT_WARNING_POP
      

      Is this an appropriate way to disable warnings?

      JonBJ Offline
      JonBJ Offline
      JonB
      wrote last edited by
      #2

      @novum
      I have never built Qt itself. But do you mean you get these warnings/errors while building Qt itself from source or do you mean when you have built it and are including its headers into your own code? If you mean the former I am "surprised" if it ships with these warnings/errors, and you are certainly not intended to have to edit Qt's own sources to make it build.

      N 1 Reply Last reply
      0
      • JonBJ JonB

        @novum
        I have never built Qt itself. But do you mean you get these warnings/errors while building Qt itself from source or do you mean when you have built it and are including its headers into your own code? If you mean the former I am "surprised" if it ships with these warnings/errors, and you are certainly not intended to have to edit Qt's own sources to make it build.

        N Offline
        N Offline
        novum
        wrote last edited by
        #3

        @JonB said in Is using `QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wwarning") QT_WARNING_POP` in the source file an appropriate way to disable warnings?:

        I have never built Qt itself. But do you mean you get these warnings/errors while building Qt itself from source or do you mean when you have built it and are including its headers into your own code? If you mean the former I am "surprised" if it ships with these warnings/errors, and you are certainly not intended to have to edit Qt's own sources to make it build.

        I build Qt itself from source. I build Qt from source to gain a deeper understanding of how the Qt framework works.

        1 Reply Last reply
        0
        • N novum

          I use the following command to configure Qt.

          ../configure -prefix $HOME/.local/Qt6 -make examples -make tests -release -optimize-size -shared -skip qt5compat -skip qtdoc \
          -skip qtwebengine -no-feature-androiddeployqt -no-feature-qdoc  -system-zlib -system-sqlite -openssl-linked -developer-build --\
          -DCMAKE_PREFIX_PATH="$HOME/.local/sqlite;$HOME/.local/openssl" -DQT_BUILD_EXAMPLES_BY_DEFAULT=OFF -DQT_BUILD_TESTS_BY_DEFAULT=OFF
          

          When building Qt sources,I get warnings treaded as errors.

          To allow specific types of warnings, I add the following code to the source file.

          QT_WARNING_PUSH
          QT_WARNING_DISABLE_GCC("-Warray-bounds")
          ...
          code
          ...
          QT_WARNING_POP
          

          Is this an appropriate way to disable warnings?

          Christian EhrlicherC Offline
          Christian EhrlicherC Offline
          Christian Ehrlicher
          Lifetime Qt Champion
          wrote last edited by
          #4

          @novum said in Is using `QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wwarning") QT_WARNING_POP` in the source file an appropriate way to disable warnings?:

          Is this an appropriate way to disable warnings?

          The correct way is to fix the warnings instead suppress them.
          If this is really not possible then you can use this macro to avoid compiler specific stuff.

          Qt Online Installer direct download: https://download.qt.io/official_releases/online_installers/
          Visit the Qt Academy at https://academy.qt.io/catalog

          N 1 Reply Last reply
          0
          • Christian EhrlicherC Christian Ehrlicher

            @novum said in Is using `QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wwarning") QT_WARNING_POP` in the source file an appropriate way to disable warnings?:

            Is this an appropriate way to disable warnings?

            The correct way is to fix the warnings instead suppress them.
            If this is really not possible then you can use this macro to avoid compiler specific stuff.

            N Offline
            N Offline
            novum
            wrote last edited by
            #5

            @Christian-Ehrlicher Ok, I got it. I will look into the source code and try to fix the warnings.

            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