u-blox / ubxlib

Portable C libraries which provide APIs to build applications with u-blox products and services. Delivered as add-on to existing microcontroller and RTOS SDKs.
Apache License 2.0
287 stars 82 forks source link

Suppress unnecessary GCC truncation warnings using compiler directives #191

Closed AarC10 closed 5 months ago

AarC10 commented 5 months ago

190 - Stop GCC from complaining in general about truncation issues using GCC compiler directives. This means that older GCC compilers will not get a warning. Tested on zephyr's eabi-gcc compiler which is on version 12.2

Unsure on whether or not we should remove the ignored variable and void cast now.

RobMeades commented 5 months ago

Hi, thanks for this. It's a shame that the non-#pramga removal mechanism doesn't work for your version of GCC; we usually try to avoid #pragma's because of the tendency of some compilers to emit an unknown #pragma, warning but I've run your PR through the test system and it doesn't appear to cause that on any of the compilers we currently support.

You will see from the All checks have failed red thingy that there's an AStyle issue in common/at_client/src/u_at_client.c:

image

If you could maybe fix that and re-push then I'll take your change internally, apply it and push it back to master here?

EDIT:

Unsure on whether or not we should remove the ignored variable and void cast now.

I think leave those in as that's the preferred mechanism that we may be able to move to at some point in the future.

RobMeades commented 5 months ago

Oh, and when you re-push you could change Supress -> Suppress also.