-
Notifications
You must be signed in to change notification settings - Fork 6.1k
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
Picolibc 1.8.5 #62882
Picolibc 1.8.5 #62882
Changes from all commits
c42b103
78f7291
b21b11e
ac5cc28
4795ff5
12ce35e
9fec59b
3f81bd8
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,39 +17,96 @@ int (*_old_char_out)(int); | |
|
||
#if defined(CONFIG_PICOLIBC) | ||
|
||
#define ZEPHYR_PICOLIBC_VERSION (__PICOLIBC__ * 10000 + \ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would be ok filtering-out individual checks as long as he minimal config isn't the default. if (IS_ENABLED(CONFIG_PICOLIBC_IO_MINIMAL)) {
ztest_test_skip();
} After all, users would explicitly be choosing to use a format that is trimmed-down, maybe non-standard, discards things, etc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not blocking though. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So just skip tests in that case instead of verifying that they generate the expected result? I'm not sure that's as useful for this test where we're kinda walking through C library configurations and making sure they work as intended? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Output is more or less an unexpected result with minimal io config anyway. I guess the question is how specific do we want to be about the deviation. Fine to be overly specific as well, but just saying you have the option to be less specific too, which means PicoLibC would not be contractually bound to Zephyr to ensure minimal io formatting is a certain way. I.e. if there ever need to be modifications to picolibc's minimal io formatter, to save a few byte here or there, there is more flexibility. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, that's a fair point. I think I'll leave this patch and burn that bridge when we get to it. |
||
__PICOLIBC_MINOR__ * 100 + \ | ||
__PICOLIBC_PATCHLEVEL__) | ||
|
||
#ifdef CONFIG_PICOLIBC_IO_MINIMAL | ||
/* | ||
* If picolibc is >= 1.8.4, then minimal printf is available. Otherwise, | ||
* we're going to get the floating point version when the minimal one is | ||
* selected. | ||
*/ | ||
#if ZEPHYR_PICOLIBC_VERSION >= 10804 | ||
#define HAS_PICOLIBC_IO_MINIMAL | ||
#else | ||
#define HAS_PICOLIBC_IO_FLOAT | ||
#endif | ||
#endif | ||
|
||
#ifdef CONFIG_PICOLIBC_IO_LONG_LONG | ||
/* | ||
* If picolibc is >= 1.8.5, then long long printf is available. Otherwise, | ||
* we're going to get the floating point version when the long long one is | ||
* selected. | ||
*/ | ||
#if ZEPHYR_PICOLIBC_VERSION >= 10805 | ||
#define HAS_PICOLIBC_IO_LONG_LONG | ||
#else | ||
#define HAS_PICOLIBC_IO_FLOAT | ||
#endif | ||
#endif | ||
|
||
#ifdef CONFIG_PICOLIBC_IO_FLOAT | ||
#define HAS_PICOLIBC_IO_FLOAT | ||
#endif | ||
|
||
/* | ||
* Picolibc long long support is present if the picolibc _WANT_IO_LONG_LONG | ||
* symbol is defined or if the Zephyr configuration has enabled floating | ||
* point support. Note that CONFIG_PICOLIBC_IO_LONG_LONG is only useful | ||
* when using the picolibc module as it cannot affect picolibc included | ||
* with the toolchain | ||
* Picolibc long long support is present if Zephyr configuration has | ||
* enabled long long or floating point support. | ||
*/ | ||
|
||
char expected_32[] = "22 113 10000 32768 40000 22\n" | ||
"p 112 -10000 -32768 -40000 -22\n" | ||
#if defined(HAS_PICOLIBC_IO_MINIMAL) | ||
"0x1 0x1 0x1 0x1 0x1\n" | ||
"0x1 0x1 0x1 0x1\n" | ||
"42 42 42 42\n" | ||
"-42 -42 -42 -42\n" | ||
"42 42 42 42\n" | ||
"42 42 42 42\n" | ||
"25542abcdef 42\n" | ||
#if defined(_WANT_MINIMAL_IO_LONG_LONG) | ||
"68719476735 -1 18446744073709551615 ffffffffffffffff\n" | ||
#else | ||
"-1 -1 4294967295 ffffffff\n" | ||
#endif | ||
#else | ||
"0x1 0x01 0x0001 0x00000001 0x0000000000000001\n" | ||
"0x1 0x 1 0x 1 0x 1\n" | ||
"42 42 0042 00000042\n" | ||
"-42 -42 -042 -0000042\n" | ||
"42 42 42 42\n" | ||
"42 42 0042 00000042\n" | ||
"255 42 abcdef 42\n" | ||
#if defined(_WANT_IO_LONG_LONG) || defined(CONFIG_PICOLIBC_IO_FLOAT) | ||
#if defined(HAS_PICOLIBC_IO_LONG_LONG) || defined(HAS_PICOLIBC_IO_FLOAT) | ||
"68719476735 -1 18446744073709551615 ffffffffffffffff\n" | ||
#else | ||
"-1 -1 4294967295 ffffffff\n" | ||
#endif | ||
#endif | ||
"0xcafebabe 0xbeef 0x2a\n" | ||
; | ||
|
||
char expected_64[] = "22 113 10000 32768 40000 22\n" | ||
"p 112 -10000 -32768 -40000 -22\n" | ||
#if defined(HAS_PICOLIBC_IO_MINIMAL) | ||
"0x1 0x1 0x1 0x1 0x1\n" | ||
"0x1 0x1 0x1 0x1\n" | ||
"42 42 42 42\n" | ||
"-42 -42 -42 -42\n" | ||
"42 42 42 42\n" | ||
"42 42 42 42\n" | ||
"25542abcdef 42\n" | ||
#else | ||
"0x1 0x01 0x0001 0x00000001 0x0000000000000001\n" | ||
"0x1 0x 1 0x 1 0x 1\n" | ||
"42 42 0042 00000042\n" | ||
"-42 -42 -042 -0000042\n" | ||
"42 42 42 42\n" | ||
"42 42 0042 00000042\n" | ||
"255 42 abcdef 42\n" | ||
#endif | ||
"68719476735 -1 18446744073709551615 ffffffffffffffff\n" | ||
"0xcafebabe 0xbeef 0x2a\n" | ||
; | ||
|
@@ -161,6 +218,8 @@ ZTEST(printk, test_printk) | |
printk("0x%x %p %-2p\n", hex, ptr, (char *)42); | ||
|
||
pk_console[pos] = '\0'; | ||
__printk_hook_install(_old_char_out); | ||
printk("expected '%s'\n", expected); | ||
zassert_true((strcmp(pk_console, expected) == 0), "printk failed"); | ||
|
||
(void)memset(pk_console, 0, sizeof(pk_console)); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is this change?
On what compiler did you see the error/warning code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
running twister using SDK version 0.16.3-rc1 on my local machine. I'm afraid I've lost the precise tree at this point. Looking at the code, I wasn't surprised by the compiler generating a spurious warning here as the assignment and use are both protected inside 'if' clauses. I'd be fine removing this patch, but as I couldn't get a clean twister run locally without it, I included it here assuming it would also be needed for the CI run against the PR.