Fix wrong format string in alarm_pool_dump_key #437

Merged
jonathangjertsen merged 1 commit from fix-alarm-pool-dump-key-format-string into develop 2021-05-24 16:32:31 -05:00
jonathangjertsen commented 2021-05-23 08:33:54 -05:00 (Migrated from github.com)

Fixes the following warning when building for host

[...]/pico-sdk/src/common/pico_time/time.c: In function 'alarm_pool_dump_key':
[...]/pico-sdk/src/common/pico_time/time.c:282:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=]
     printf("%ld", to_us_since_boot(get_entry(pool, id)->target));
             ~~^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
             %I64d

PRIu64 and PRId64 are in the C99 standard, so maybe all uses of the nonstandard %llu and %lld specifiers should be replaced with those?

Fixes the following warning when building for host ``` [...]/pico-sdk/src/common/pico_time/time.c: In function 'alarm_pool_dump_key': [...]/pico-sdk/src/common/pico_time/time.c:282:15: warning: format '%ld' expects argument of type 'long int', but argument 2 has type 'uint64_t' {aka 'long long unsigned int'} [-Wformat=] printf("%ld", to_us_since_boot(get_entry(pool, id)->target)); ~~^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ %I64d ``` `PRIu64` and `PRId64` are in the C99 standard, so maybe all uses of the nonstandard `%llu` and `%lld` specifiers should be replaced with those?
lurch commented 2021-05-24 08:20:08 -05:00 (Migrated from github.com)
Doing a quick `git grep` of the source code for `to_us_since_boot`, it seems that the SDK variously uses: * "%lld" https://github.com/raspberrypi/pico-sdk/blob/master/src/common/pico_time/time.c#L277 * PRIu64 https://github.com/raspberrypi/pico-sdk/blob/master/test/pico_stdlib_test/pico_stdlib_test.c#L34 * PRIi64 https://github.com/raspberrypi/pico-sdk/blob/master/test/pico_time_test/pico_time_test.c#L179
kilograham (Migrated from github.com) approved these changes 2021-05-24 16:32:18 -05:00
Sign in to join this conversation.
No reviewers
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
gh-raspberrypi/pico-sdk!437
No description provided.