Repository navigation
Fix various warnings associated with stricter compiler settings - #73
Conversation
|
I will have a look at this shortly. Does this compile on both clang and GCC? I have a feeling the narrowing warning was there for one of the compilers. |
|
This builds for me with clang 16.0.6 and 19.1.7. And of course GCC 12. A wee snippet of the clang-19 build: |
|
Right, I see the change now (I was on my phone) and the mask is a nice improvement. I think I was confusing it with something else (size of |
|
|
||
| public: | ||
| const device *const getDevice(); | ||
| const device *getDevice(); |
There was a problem hiding this comment.
What is the reason for this? The field is still const device *const.
There was a problem hiding this comment.
It was flagged by -Wextra because the function is returning a copy of the pointer and so the extra constraint doesn't actually do anything - i.e., the user could do whatever they like with their own copy. But aye, the field itself is still indeed constraint properly
There was a problem hiding this comment.
Oh I see. Fair enough.
| /* Zephyr's C headers declare functions named after the structs they take (fs_statvfs, | ||
| * net_if_mcast_monitor). In C++ that hides the struct's implicit constructor, which | ||
| * -Wshadow reports in every file that includes this header. Nothing here uses those | ||
| * constructors, so the check is suspended for these includes only. */ |
| /* ext_id is a 29-bit field and a CAN identifier is at most 29 bits, so the mask | ||
| * is lossless; it exists to make that explicit to the compiler | ||
| */ | ||
| ext_id = id.getId() & CAN_EXT_ID_MASK; |
Fixes issues associated with various (stricter) compiler flags enabled:
Also fixes CMake warnings when the module is included in a west manifest but isn't built for a target.