Is using `QT_WARNING_PUSH QT_WARNING_DISABLE_GCC("-Wwarning") QT_WARNING_POP` in the source file an appropriate way to disable warnings?
-
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=OFFWhen 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_POPIs this an appropriate way to disable warnings?
-
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=OFFWhen 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_POPIs this an appropriate way to disable warnings?
@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. -
@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.@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.
-
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=OFFWhen 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_POPIs this an appropriate way to disable warnings?
@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. -
@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.@Christian-Ehrlicher Ok, I got it. I will look into the source code and try to fix the warnings.