-
Notifications
You must be signed in to change notification settings - Fork 647
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
Make buffered printf to be a common feature #1483
Conversation
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
core/config.h
Outdated
/* Enable buffered printf for builtin libc or not */ | ||
#ifndef BH_BUILTIN_LIBC_BUFFERED_PRINTF | ||
#define BH_BUILTIN_LIBC_BUFFERED_PRINTF 0 | ||
#define BH_BUILTIN_LIBC_BUFFERED_SIZE 128 | ||
#define BH_BUILTIN_LIBC_BUFFERED_PREFIX | ||
#endif |
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.
There are too many macros in config.h, these macro are only related to libc_builtin_wrapper.c, how about moving them to it?
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.
OK
#if BH_BUILTIN_LIBC_BUFFERED_PRINTF != 0 | ||
BH_BUILTIN_LIBC_BUFFERED_PREFIX static char | ||
print_buf[BH_BUILTIN_LIBC_BUFFERED_SIZE] = { 0 }; | ||
BH_BUILTIN_LIBC_BUFFERED_PREFIX static int print_buf_size = 0; |
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.
How about:
#ifndef BUILTIN_LIBC_BUFFERED_PRINTF
#define BUILTIN_LIBC_BUFFERED_PRINTF 0
#endif
#if BUILTIN_LIBC_BUFFERED_PRINTF != 0
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_SIZE
#define BUILTIN_LIBC_BUFFERED_PRINT_SIZE 128
#endif
#ifndef BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
#define BUILTIN_LIBC_BUFFERED_PRINT_PREFIX
#endif
BUILTIN_LIBC_BUFFERED_PRINT_PREFIX static char
print_buf[BUILTIN_LIBC_BUFFERED_PRINT_SIZE] = { 0 };
BUILTIN_LIBC_BUFFERED_PRINT_PREFIX static int print_buf_size = 0;
...
{ | ||
} |
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.
Should not change it, or CI code guideline will report error.
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.
Emm, it was changed by clang-format
|
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
BH_BUILTIN_LIBC_BUFFERED_PREFIX static char | ||
print_buf[BH_BUILTIN_LIBC_BUFFERED_SIZE] = { 0 }; | ||
BH_BUILTIN_LIBC_BUFFERED_PREFIX static int print_buf_size = 0; |
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.
Should remove BUILTIN_LIBC_BUFFERED_PRINT_PREFIX and BUILTIN_LIBC_BUFFERED_PRINT_SIZE
#define BH_BUILTIN_LIBC_BUFFERED_PRINTF 1 | ||
#define BH_BUILTIN_LIBC_BUFFERED_SIZE 128 | ||
#define BH_BUILTIN_LIBC_BUFFERED_PREFIX |
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.
Same as above
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.
Sure, forget to rename these symbols
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
…ce#1483) Add macros to control whether to use the libc-builtin buffered printf and the buffer size.
@wenyongh BTW, I can't find the origin definition of
BH_PLATFORM_OPENRTOS
, do you know where it defined ?