Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

build is failing when newlib is enabled #4638

Closed
ramakrishnapallala opened this issue Oct 31, 2017 · 5 comments
Closed

build is failing when newlib is enabled #4638

ramakrishnapallala opened this issue Oct 31, 2017 · 5 comments
Labels
bug The issue is a bug, or the PR is fixing a bug

Comments

@ramakrishnapallala
Copy link

timer_monotonic (tests/kernel/timer/timer_monotonic/) is throwing following warnings when we compile the test with newlibc enabled (CONFIG_NEWLIB_LIBC=y).

And due this shippable is failing on newlibc dependent patches.

In file included from /home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:9:0:
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c: In function âmainâ:
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:60:13: warning: format â%ldâ expects argument of type âlong intâ, but argument 2 has type âs32_t {aka int}â [-Wformat=]
TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
^
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/include/tc_util.h:22:37: note: in definition of macro âPRINT_DATAâ
#define PRINT_DATA(fmt, ...) printk(fmt, ##VA_ARGS)
^~~
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:60:4: note: in expansion of macro âTC_PRINTâ
TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
^~~~~~~~
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:60:13: warning: format â%luâ expects argument of type âlong unsigned intâ, but argument 3 has type âu32_t {aka unsigned int}â [-Wformat=]
TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
^
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/include/tc_util.h:22:37: note: in definition of macro âPRINT_DATAâ
#define PRINT_DATA(fmt, ...) printk(fmt, ##VA_ARGS)
^~~
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:60:4: note: in expansion of macro âTC_PRINTâ
TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
^~~~~~~~
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:60:13: warning: format â%luâ expects argument of type âlong unsigned intâ, but argument 4 has type âu32_t {aka unsigned int}â [-Wformat=]
TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
^
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/include/tc_util.h:22:37: note: in definition of macro âPRINT_DATAâ
#define PRINT_DATA(fmt, ...) printk(fmt, ##VA_ARGS)
^~~
/home/rpallala/ssg-otc/zephyr/31st-Oct/zephyr/tests/kernel/timer/timer_monotonic/src/main.c:60:4: note: in expansion of macro âTC_PRINTâ
TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
^~~~~~~~

@ramakrishnapallala
Copy link
Author

The issue coming from the following TC_PRINT statement:
tests/kernel/timer/timer_monotonic/src/main.c

TC_PRINT("diff = %" PRId32 " (t_last = %" PRIu32
" : t_now = %" PRIu32 "); i = %u\n",

If change the statement as below, no issue is seen:
TC_PRINT("diff = %d (t_last = %u : t_now = %u); i = %u\n",
diff, t_last, t_now, i);

what is the significance of using "PRId32/PRIu32" ?

@nashif nashif changed the title Shippable is failing when newlibc is enbaled build is failing when newlib is enabled Oct 31, 2017
@andrewboie
Copy link
Contributor

The fix is to not mix zephyr/types.h and newlib's inttypes.h which this code appears to be doing

@andrewboie
Copy link
Contributor

what is the significance of using "PRId32/PRIu32" ?

http://pubs.opengroup.org/onlinepubs/009695399/basedefs/inttypes.h.html

We used to use these.
Then it was decided for Zephyr to use its own types instead.

@andrewboie andrewboie added the bug The issue is a bug, or the PR is fixing a bug label Nov 1, 2017
@ramakrishnapallala
Copy link
Author

ramakrishnapallala commented Nov 2, 2017

Can i remove the "inttypes.h" and use regular format specifiers(%d/, %u) to fix the issue?

@ramakrishnapallala
Copy link
Author

PR merged:
#4703

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug The issue is a bug, or the PR is fixing a bug
Projects
None yet
Development

No branches or pull requests

2 participants