Skip to content

Add -Wall -Wextra -Werror compilation flags#28

Merged
mansandersson merged 14 commits into
NIBEGroup:mainfrom
d-serj:feature/compilation_flags
Jun 5, 2026
Merged

Add -Wall -Wextra -Werror compilation flags#28
mansandersson merged 14 commits into
NIBEGroup:mainfrom
d-serj:feature/compilation_flags

Conversation

@d-serj

@d-serj d-serj commented May 25, 2026

Copy link
Copy Markdown
Contributor

This PR enables GCC/Clang compiler warnings (-Wall -Wextra -Werror) for both library and unit tests, and adds optional AddressSanitizer support. All warnings found by the new flags are fixed.

Bugs fixed while enabling warnings:

  • websocket.c - return value of lws_write() was incorrectly compared against an unsigned variable so that negative error codes were not detected
  • eebus_data_choice.c - IsNull() and IsEmpty() were returning an error code integer through bool return type

Warning fixes:

  • Added UNUSED() macro calls for unused function parameters
  • Fixed struct initializer syntax ({0} -> {{0}}) in test files and spine model enum tables (-Wmissing-field-initializers)
  • Fixed printf format specifiers in EebusDateToString() to use %u matching the unsigned cast (-Wformat)
  • Reordered null checks in StringLutRecordInit() and Uint64LutRecordInit() so memset is never reached with NULL pointer (-Werror=maybe-uninitialized)

Comment thread src/common/eebus_data/eebus_data_choice.c
Comment thread src/common/eebus_data/eebus_data_choice_root.c
Comment thread src/common/eebus_data/eebus_data_list.c
Comment thread src/common/eebus_data/eebus_data_stub.c
Comment thread src/common/eebus_date_time/eebus_date.c Outdated
Comment thread src/ship/ship_connection/ship_connection_debug.c
Comment thread src/use_case/actor/common/load_control.c Outdated

@gennadiyvt gennadiyvt left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Added some nice-to-have remarks

@mansandersson mansandersson merged commit 10f23a0 into NIBEGroup:main Jun 5, 2026
5 checks passed
@mansandersson

Copy link
Copy Markdown
Contributor

Thank you for your contribution

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