-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
lib: os: cbprintf: Add C++ support for static packaging #34697
lib: os: cbprintf: Add C++ support for static packaging #34697
Conversation
86af0f6
to
758175c
Compare
include/sys/cbprintf_cxx.h
Outdated
} | ||
|
||
/* C++ version for long double detection. */ | ||
static inline bool z_cbprintf_cxx_is_longdouble(long double arg) |
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 does this return bool
when the equivalent for pchar
returns int
?
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.
is_pchar is used in FOREACH loop to calculate number of char pointers in the argument list. This one is used for assert. I can change that to int for consistency.
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.
I think that makes sense, since the C version appears to evaluate to 0 or 1.
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.
done
Added C++ replacements for macros that are using _Generic keyword. Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
Extended test suite to be run for C++ Signed-off-by: Krzysztof Chruscinski <krzysztof.chruscinski@nordicsemi.no>
758175c
to
5c85454
Compare
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.
I don't see any particular problems with this, but I also haven't looked closely nor have I tried any of this, so I'm reluctant to casually approve it. I would rather see this reviewed/approved by people who are invested in C++ Zephyr, such as @alexanderwachter.
Ping @Thurnheer |
Static packaging was using
_Generic
C11 keyword which is not supported by C++.#34516 forced always runtime packaging in C++ which results in slower packaging (finally logging) from C++ files.
_Generic
can be implemented in C++ using function overloading and template. Extended cbprintf_package test to be run for c++ (main.c content copied to test.inc).