[Fix] compiler errors and warnings#72
Merged
Merged
Conversation
Collaborator
QuangHaiNguyen
commented
Apr 11, 2026
- Activate several common build flag (check CMake file in src)
- Fix all compiler errors/warnings
There was a problem hiding this comment.
Pull request overview
This PR aims to make the framework build cleanly under stricter compiler settings by enabling common warning/security flags in CMake and addressing a broad set of compiler warnings/errors across core modules and unit tests.
Changes:
- Enable stricter GCC/Clang compile flags (including
-Werror) and adjust per-file options where needed. - Fix numerous warnings via unused-parameter handling, type casts, pointer arithmetic fixes, and API type alignment.
- Update versioning metadata (project/version header) and remove an unused assert source unit.
Reviewed changes
Copilot reviewed 36 out of 36 changed files in this pull request and generated 11 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/utilities/queue/unittest_ez_queue.c | Removes unused local variable in queue tests. |
| tests/utilities/linked_list/unittest_ez_linked_list.c | Removes unused local variable in linked-list tests. |
| tests/service/task_worker/unittest_ez_task_worker.c | Removes unused local variable in task worker tests. |
| tests/service/state_machine/unittest_ez_state_machine.c | Suppresses unused-parameter warnings; fixes counter increment in handler. |
| tests/service/rpc/unittest_ez_rpc.cpp | Suppresses unused-parameter warnings in test callbacks. |
| tests/service/event_bus/unittest_ez_event_bus.c | Fixes a syntax issue (;;) in a test struct. |
| tests/service/driver/uart/unittest_ez_uart.c | Suppresses unused-parameter warnings in mock UART driver. |
| tests/service/datamodel/unittest_ez_datamodel.cpp | Updates data point initializer (adds dirty flag) and fixes shadowing. |
| tests/service/cli/unittest_ez_cli.c | Suppresses unused-parameter warnings; adds cast for sprintf argument type. |
| src/utilities/queue/ez_queue.c | Adjusts logging formats, allocator argument types, and hexdump size casts. |
| src/utilities/hexdump/ez_hexdump.c | Updates hexdump API to use a wider size type; minor cleanup/typo fix. |
| src/utilities/CMakeLists.txt | Removes assert/ez_assert.c from utilities build sources. |
| src/utilities/assert/ez_assert.c | Deletes a no-op implementation file. |
| src/service/task_worker/ez_task_worker.c | Fixes void* pointer arithmetic; suppresses unused args in no-RTOS paths. |
| src/service/state_machine/ez_state_machine.c | Casts ring buffer size to match API expectations. |
| src/service/rpc/ez_rpc.c | Narrows some stored types, fixes header serialization, and suppresses unused results. |
| src/service/ipc/ez_ipc.c | Minor comment-block formatting fix. |
| src/service/event_bus/ez_event_bus.c | Removes an unused local variable; minor size cast. |
| src/service/data_model/ez_data_model.c | Removes ineffective const return; adjusts assert formatting. |
| src/service/cli/ez_cli.c | Fixes an assignment bug, adjusts pointer handling/casts, and narrows send sizes. |
| src/middlewares/osal/ez_osal_threadx.c | Adds casts and unused-arg suppression for stricter warnings. |
| src/middlewares/osal/ez_osal_freertos.c | Fixes return type conversions and suppresses unused variable warnings. |
| src/middlewares/osal/CMakeLists.txt | Adds per-file compile option to avoid cast-function-type being treated as error. |
| src/hal/uart/ez_uart.c | Suppresses unused-parameter warning in non-debug builds. |
| src/hal/gpio/ez_gpio.c | Removes unused local variable. |
| src/CMakeLists.txt | Adds strict GCC/Clang warning/security flags (incl. -Werror, -Wconversion). |
| samples/linux/main.c | Fixes main signature and return value for hosted environments. |
| inc/utilities/logging/ez_logging.h | Renames color macros to EZ_* to reduce collisions; updates logging macros accordingly. |
| inc/utilities/hexdump/ez_hexdump.h | Updates hexdump API declaration to use uint32_t size. |
| inc/service/rpc/ez_rpc.h | Aligns response UUID type; removes unused local variable in inline helper. |
| inc/service/data_model/ez_data_model.h | Removes ineffective const from uint32_t return type. |
| inc/service/cli/ez_cli.h | Fixes callback typedef return qualifier (const char -> char). |
| inc/middlewares/osal/ez_osal.h | Ensures handles are initialized in OSAL handle-definition macros. |
| inc/ez_version.h | Updates SDK patch version string and numeric macros. |
| CMakeLists.txt | Sets C++ standard and bumps project version; removes version-header generation. |
| cmake/ez_version.h.in | Deletes the template previously used to generate inc/ez_version.h. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5c9abf5 to
11e65aa
Compare
- Activate several common build flag (check CMake file in src) - Fix all compiler errors/warnings
11e65aa to
58570a5
Compare
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 39 out of 40 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (1)
src/service/event_bus/ez_event_bus.c:287
- event_data_size is size_t but is cast to uint32_t when reserving queue space. Combined with ezQueue_ReserveElement allocating via a uint16_t allocator, large payloads can truncate and then memcpy() will overflow the reserved buffer. Add explicit bounds checks for event_data_size (<= UINT16_MAX if using ezStaticAlloc) and return an error when exceeded, instead of truncating.
q_element_event_code = ezQueue_ReserveElement(&event_bus->event_queue, &code, sizeof(uint32_t));
q_element_data = ezQueue_ReserveElement(&event_bus->event_queue, &data, (uint32_t)event_data_size);
if(q_element_event_code == NULL || q_element_data == NULL)
{
EZWARNING("Cannot reserve event queue element");
ezQueue_ReleaseReservedElement(&event_bus->event_queue, q_element_event_code);
ezQueue_ReleaseReservedElement(&event_bus->event_queue, q_element_data);
return false;
}
*(uint32_t*)code = event_code;
memcpy(data, event_data, event_data_size);
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.