Skip to content

quality: improve warning flags and fix issues#321

Open
VDanielEdwards wants to merge 3 commits into
mainfrom
dev/quality/streamline-warning-flags
Open

quality: improve warning flags and fix issues#321
VDanielEdwards wants to merge 3 commits into
mainfrom
dev/quality/streamline-warning-flags

Conversation

@VDanielEdwards
Copy link
Copy Markdown
Member

@VDanielEdwards VDanielEdwards commented May 7, 2026

Subject

Enables more warning flags for GCC and fixes resulting issues.

Developer checklist (address before review)

  • Changelog.md updated
  • Prepared update for depending repositories
  • Documentation updated (public API changes only)
  • API docstrings updated (public API changes only)
  • Rebase → commit history clean
  • Squash and merge → proper PR title

@VDanielEdwards VDanielEdwards self-assigned this May 7, 2026
@VDanielEdwards VDanielEdwards force-pushed the dev/quality/streamline-warning-flags branch 5 times, most recently from e1d392d to 849161f Compare May 7, 2026 10:27
@VDanielEdwards VDanielEdwards changed the title quality: improve warning flags for gcc and fix issues quality: improve warning flags and fix issues May 7, 2026
@VDanielEdwards VDanielEdwards marked this pull request as ready for review May 7, 2026 11:04
@VDanielEdwards VDanielEdwards requested a review from MariusBgm May 7, 2026 11:05
@VDanielEdwards VDanielEdwards force-pushed the dev/quality/streamline-warning-flags branch 2 times, most recently from f934ab0 to 56f0468 Compare May 7, 2026 14:31
Copy link
Copy Markdown
Collaborator

@MariusBgm MariusBgm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Comment thread SilKit/cmake/SilKitBuildSettings.cmake Outdated
Comment thread SilKit/source/SilKitForceIncludes.cpp
@VDanielEdwards VDanielEdwards added needs reviewer This issue is looking for a reviewer. and removed needs reviewer This issue is looking for a reviewer. labels May 8, 2026
@VDanielEdwards VDanielEdwards force-pushed the dev/quality/streamline-warning-flags branch from 8a9068f to 07a92d1 Compare May 11, 2026 08:46
…headers, ifdefs, dummy source

Signed-off-by: Daniel Edwards <Daniel.Edwards@vector.com>
@VDanielEdwards VDanielEdwards force-pushed the dev/quality/streamline-warning-flags branch from 07a92d1 to 7ce3fee Compare May 11, 2026 08:48
…tem include directory

Signed-off-by: Daniel Edwards <Daniel.Edwards@vector.com>
@VDanielEdwards VDanielEdwards force-pushed the dev/quality/streamline-warning-flags branch from 7ce3fee to 33d91cf Compare May 12, 2026 08:21
Signed-off-by: Daniel Edwards <Daniel.Edwards@vector.com>
@VDanielEdwards VDanielEdwards force-pushed the dev/quality/streamline-warning-flags branch from 33d91cf to 42466c6 Compare May 12, 2026 10:01
@VDanielEdwards
Copy link
Copy Markdown
Member Author

VDanielEdwards commented May 12, 2026

Do you see any issues on your end regarding the changes in warning flags?

You'll only have to take a look at this commit - the other changes are just fixing stuff found through additional warnings.

@snps-fricke

@snps-behrens
Copy link
Copy Markdown
Collaborator

Interestingly, these changes cause gcc12.3 to run into a free-nonheap-object warning. The warning is not hit by gcc9.5 or gcc13.2 (the two other compiler versions I tested), and is only hit when compiling with build type Release and not when compiling with Debug.

GCC error: ```sh In file included from .../gcc/12.3/include/c++/12.3.0/x86_64-pc-linux-gnu/bits/c++allocator.h:33, from .../gcc/12.3/include/c++/12.3.0/bits/allocator.h:46, from .../gcc/12.3/include/c++/12.3.0/string:41, from .../gcc/12.3/include/c++/12.3.0/stdexcept:39, from .../sil-kit/SilKit/include/silkit/participant/exception.hpp:7, from .../sil-kit/SilKit/include/silkit/SilKit.hpp:8, from .../sil-kit/Demos/communication/include/ApplicationBase.hpp:5, from .../sil-kit/Demos/communication/Rpc/RpcServerDemo.cpp:5: In member function 'void std::__new_allocator<_Tp>::deallocate(_Tp*, size_type) [with _Tp = unsigned char]', inlined from 'static void std::allocator_traits >::deallocate(allocator_type&, pointer, size_type) [with _Tp = unsigned char]' at .../gcc/12.3/include/c++/12.3.0/bits/alloc_traits.h:496:23, inlined from 'void std::_Vector_base<_Tp, _Alloc>::_M_deallocate(pointer, std::size_t) [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:387:19, inlined from 'std::_Vector_base<_Tp, _Alloc>::~_Vector_base() [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:366:15, inlined from 'std::vector<_Tp, _Alloc>::~vector() [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:733:7, inlined from 'RpcServer::CreateControllers()::' at .../sil-kit/Demos/communication/Rpc/RpcServerDemo.cpp:86:9: .../gcc/12.3/include/c++/12.3.0/bits/new_allocator.h:158:33: error: 'void operator delete(void*, std::size_t)' called on pointer '' with nonzero offset [1, 4294967295] [-Werror=free-nonheap-object] 158 | _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n)); | ^ In member function '_Tp* std::__new_allocator<_Tp>::allocate(size_type, const void*) [with _Tp = unsigned char]', inlined from 'static _Tp* std::allocator_traits >::allocate(allocator_type&, size_type) [with _Tp = unsigned char]' at .../gcc/12.3/include/c++/12.3.0/bits/alloc_traits.h:464:28, inlined from 'std::_Vector_base<_Tp, _Alloc>::pointer std::_Vector_base<_Tp, _Alloc>::_M_allocate(std::size_t) [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:378:33, inlined from 'void std::_Vector_base<_Tp, _Alloc>::_M_create_storage(std::size_t) [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:395:44, inlined from 'std::_Vector_base<_Tp, _Alloc>::_Vector_base(std::size_t, const allocator_type&) [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:332:26, inlined from 'std::vector<_Tp, _Alloc>::vector(const std::vector<_Tp, _Alloc>&) [with _Tp = unsigned char; _Alloc = std::allocator]' at .../gcc/12.3/include/c++/12.3.0/bits/stl_vector.h:598:61, inlined from 'RpcServer::CreateControllers()::' at .../sil-kit/Demos/communication/Rpc/RpcServerDemo.cpp:72:57: .../gcc/12.3/include/c++/12.3.0/bits/new_allocator.h:137:55: note: returned from 'void* operator new(std::size_t)' 137 | return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp))); | ^ ```

This is not a big deal for us at this point in time, as we are currently using gcc9.5 as our primary compiler for SilKit. However, anybody that uses gcc12.3 (and maybe even other minor versions of gcc12; I didn't test any others) would probably run into this same warning/error. On the other hand, this seems like it might actually be a bug in that version of gcc, as older and newer versions of gcc do not produce the warning, so it might not be worth 'fixing' in the SilKit code base. What are your thoughts @snps-fricke @VDanielEdwards ?

We are also still seeing some -Wuseless-cast warnings coming out of the oatpp compilation when using gcc (independent of compiler version), and some C4068: unknown pragma 'GCC' warnings coming out of MSVC (tried with toolchain versions 14.29 (VS2019) and 14.34 (VS2022)). Would it be sensible to explicitly turn those warnings off for that submodule in the ThirdParty CMake, similar to how it is already done with /wd4244 for MSVC?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants