Describe the bug
GCC with -Os optimization level generates a warning.
To Reproduce
git clone https://github.com/nasa/osal
cd osal
cmake -S . -B build_osal -DCMAKE_C_FLAGS="-Os" -DOSAL_SYSTEM_BSPTYPE=generic-linux
ninja -C build_osal
Build Log
CMake Deprecation Warning at CMakeLists.txt:91 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
-- The C compiler identification is GNU 15.2.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /usr/lib/ccache/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- BSP Selection: generic-linux at /home/yashi/src/osal/src/bsp/generic-linux
-- OSAL Selection: posix at /home/yashi/src/osal/src/os/posix
-- OSAL Compile Definitions: _XOPEN_SOURCE=600;_POSIX_OS_
CMake Deprecation Warning at docs/src/CMakeLists.txt:31 (cmake_minimum_required):
Compatibility with CMake < 3.10 will be removed from a future version of
CMake.
Update the VERSION argument <min> value. Or, use the <min>...<max> syntax
to tell CMake that the project requires at least <min> but has been updated
to work with policies introduced by <max> or earlier.
-- Configuring done (0.1s)
-- Generating done (0.0s)
-- Build files have been written to: /home/yashi/src/osal/build_osal
ninja: Entering directory `build_osal'
[46/111] Building C object CMakeFiles/osal.dir/src/os/shared/src/osapi-idmap.c.o
/home/yashi/src/osal/src/os/shared/src/osapi-idmap.c: In function ‘OS_ObjectIdFindNextFree’:
/home/yashi/src/osal/src/os/shared/src/osapi-idmap.c:646:39: warning: ‘objtype_state’ may be used uninitialized [-Wmaybe-uninitialized]
646 | objtype_state->last_id_issued = token->obj_id;
| ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
/home/yashi/src/osal/src/os/shared/src/osapi-idmap.c:597:25: note: ‘objtype_state’ was declared here
597 | OS_objtype_state_t *objtype_state;
| ^~~~~~~~~~~~~
[111/111] Linking C static library ut-stubs/libut_osapi_stubs.a
Expected behavior
No warnig with -Os optimization level.
System observed on:
- Hardware
- OS: Debian GNU/Linux Sid
- Versions:
- OSAL: 5.0.0-bv-1220-g535d261f
- GCC: 15.2.0
- CMake: 3.31.6
Describe the bug
GCC with
-Osoptimization level generates a warning.To Reproduce
Build Log
Expected behavior
No warnig with
-Osoptimization level.System observed on: