Archived issue #0032650
Coding Rules - QA warnings in 7.5.3
Description
On Gentoo Linux we're getting a few QA warnings about null pointers being used:
* /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3/src/GeomliteTest/GeomliteTest_API2dCommands.cxx:451:33: warning: ‘this’ pointer is null [-Wnonnull]
* /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3/src/GeomliteTest/GeomliteTest_API2dCommands.cxx:455:33: warning: ‘this’ pointer is null [-Wnonnull]
* /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3/src/ViewerTest/ViewerTest_ViewerCommands.cxx:8282:34: warning: ‘this’ pointer is null [-Wnonnull]
* /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3/src/GeomliteTest/GeomliteTest_API2dCommands.cxx:451:33: warning: ‘this’ pointer is null [-Wnonnull]
* /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3/src/GeomliteTest/GeomliteTest_API2dCommands.cxx:455:33: warning: ‘this’ pointer is null [-Wnonnull]
* /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3/src/ViewerTest/ViewerTest_ViewerCommands.cxx:8282:34: warning: ‘this’ pointer is null [-Wnonnull]
Steps to reproduce
Not sure how to reproduce on other Linux distros.
1. install required dependencies
2. add -frecord-gcc-switches to CFLAGS and -Wl,--defsym=__gentoo_check_ldflags__=0 to LDFLAGS. You might need to add additional warnings flags to CFLAGS to actually get the warnings.
3 run cmake -C /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_DOC_Overview=yes -DBUILD_Inspector=yes -DBUILD_WITH_DEBUG=no -DINSTALL_DIR_BIN=lib64/opencascade-7.5.3/bin -DINSTALL_DIR_CMAKE=lib64/cmake/opencascade-7.5.3 -DINSTALL_DIR_DOC=share/doc/opencascade-7.5.3 -DINSTALL_DIR_LIB=lib64/opencascade-7.5.3 -DINSTALL_DIR_SCRIPT=lib64/opencascade-7.5.3/bin -DINSTALL_DIR_WITH_VERSION=ON -DINSTALL_SAMPLES=yes -DINSTALL_TEST_CASES=NO -DUSE_D3D=NO -DUSE_FFMPEG=yes -DUSE_FREEIMAGE=no -DUSE_FREETYPE=ON -DUSE_GLES2=no -DUSE_RAPIDJSON=yes -DUSE_TBB=yes -DUSE_VTK=yes -DINSTALL_DOC_Overview=ON -D3RDPARTY_QT_DIR=/usr -DBUILD_SAMPLES_QT=ON -D3RDPARTY_VTK_DIR=/usr -D3RDPARTY_VTK_INCLUDE_DIR=/usr/include/vtk-9.0 -D3RDPARTY_VTK_LIBRARY_DIR=/usr/lib64 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3_build/gentoo_toolchain.cmake /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3
4. run ninja or cmake --build
5. scan the logfiles for -Wnonnull entries
If you have access to a Gentoo Linux system:
1. add the entries for CFLAGS and LDFALGS from 2. above to /etc/portage/make.conf
2. run: USE="doc examples ffmpeg json tbb vtk" emerge =opencascade-7.5.3
3. The output above should be shown after emerge is finished.
1. install required dependencies
2. add -frecord-gcc-switches to CFLAGS and -Wl,--defsym=__gentoo_check_ldflags__=0 to LDFLAGS. You might need to add additional warnings flags to CFLAGS to actually get the warnings.
3 run cmake -C /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3_build/gentoo_common_config.cmake -G Ninja -DCMAKE_INSTALL_PREFIX=/usr -DBUILD_DOC_Overview=yes -DBUILD_Inspector=yes -DBUILD_WITH_DEBUG=no -DINSTALL_DIR_BIN=lib64/opencascade-7.5.3/bin -DINSTALL_DIR_CMAKE=lib64/cmake/opencascade-7.5.3 -DINSTALL_DIR_DOC=share/doc/opencascade-7.5.3 -DINSTALL_DIR_LIB=lib64/opencascade-7.5.3 -DINSTALL_DIR_SCRIPT=lib64/opencascade-7.5.3/bin -DINSTALL_DIR_WITH_VERSION=ON -DINSTALL_SAMPLES=yes -DINSTALL_TEST_CASES=NO -DUSE_D3D=NO -DUSE_FFMPEG=yes -DUSE_FREEIMAGE=no -DUSE_FREETYPE=ON -DUSE_GLES2=no -DUSE_RAPIDJSON=yes -DUSE_TBB=yes -DUSE_VTK=yes -DINSTALL_DOC_Overview=ON -D3RDPARTY_QT_DIR=/usr -DBUILD_SAMPLES_QT=ON -D3RDPARTY_VTK_DIR=/usr -D3RDPARTY_VTK_INCLUDE_DIR=/usr/include/vtk-9.0 -D3RDPARTY_VTK_LIBRARY_DIR=/usr/lib64 -DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_TOOLCHAIN_FILE=/var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3_build/gentoo_toolchain.cmake /var/tmp/portage/sci-libs/opencascade-7.5.3/work/occt-V7_5_3
4. run ninja or cmake --build
5. scan the logfiles for -Wnonnull entries
If you have access to a Gentoo Linux system:
1. add the entries for CFLAGS and LDFALGS from 2. above to /etc/portage/make.conf
2. run: USE="doc examples ffmpeg json tbb vtk" emerge =opencascade-7.5.3
3. The output above should be shown after emerge is finished.
Additional information
The package builds and installs without errors, although I didn't do any runtime testing or testing with applications using the library.
See also: https://dev.opencascade.org/content/qa-warnings-753 and the attached build log. The warning starts at line 18119
See also: https://dev.opencascade.org/content/qa-warnings-753 and the attached build log. The warning starts at line 18119
Public activity
7 archived notes
Participants are labeled by their role within this record.
These 3 warnings should be fixed by #0032640 and included into OCCT 7.6.0.
Could you run the build for 7.6.0 and check if they are fixed / nothing new reported?
Could you run the build for 7.6.0 and check if they are fixed / nothing new reported?
The first two are fixed in 7.6.0, the last warning ViewerTest_ViewerCommands.cxx is still showing, but on a different line: 7193
Commenter 2, I think the last one should be fixed by #0032676. Which OCCT version you have checked (the last fix is not in OCCT 7.6.0)?
Commenter 3 I checked with 7.6.0
With 7.6.1, the first two warnings no longer show up, but the last one's still there.
Commenter 2
> With 7.6.1, the first two warnings no longer show up, but the last one's still there.
This is because #0032676 targets OCCT 7.7.0, not 7.6.x
> With 7.6.1, the first two warnings no longer show up, but the last one's still there.
This is because #0032676 targets OCCT 7.7.0, not 7.6.x
Those three issue are gone in 7.7.0_beta, but a new one has been introduced:
* /var/tmp/portage-ondisk/portage/sci-libs/opencascade-7.7.0_beta/work/opencascade-7.7.0-beta/src/StepToTopoDS/StepToTopoDS_TranslateShell.cxx:143:27: warning: ‘this’ pointer is null [-Wnonnull]
* /var/tmp/portage-ondisk/portage/sci-libs/opencascade-7.7.0_beta/work/opencascade-7.7.0-beta/src/StepToTopoDS/StepToTopoDS_TranslateShell.cxx:143:27: warning: ‘this’ pointer is null [-Wnonnull]
Related records