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

Make buffered printf to be a common feature #1483

Merged
merged 3 commits into from
Sep 15, 2022

Conversation

no1wudi
Copy link
Collaborator

@no1wudi no1wudi commented Sep 14, 2022

@wenyongh BTW, I can't find the origin definition of BH_PLATFORM_OPENRTOS, do you know where it defined ?

@no1wudi no1wudi changed the title Make buffered printf become a common feature Make buffered printf to be a common feature Sep 14, 2022
Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
core/config.h Outdated
Comment on lines 279 to 284
/* 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
Copy link
Contributor

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?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK

Comment on lines 348 to 351
#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;
Copy link
Contributor

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;
...

Comment on lines 888 to 889
{
}
Copy link
Contributor

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.

Copy link
Collaborator Author

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

@wenyongh
Copy link
Contributor

@wenyongh BTW, I can't find the origin definition of BH_PLATFORM_OPENRTOS, do you know where it defined ?

BH_PLATFORM_OPENRTOS is used in another project which isn't open sourced, but it should be OK to apply similar changes to it.

Signed-off-by: Huang Qi <huangqi3@xiaomi.com>
Comment on lines 360 to 362
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;
Copy link
Contributor

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

Comment on lines 80 to 82
#define BH_BUILTIN_LIBC_BUFFERED_PRINTF 1
#define BH_BUILTIN_LIBC_BUFFERED_SIZE 128
#define BH_BUILTIN_LIBC_BUFFERED_PREFIX
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Collaborator Author

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>
@wenyongh wenyongh merged commit bbea005 into bytecodealliance:main Sep 15, 2022
victoryang00 pushed a commit to victoryang00/wamr-aot-gc-checkpoint-restore that referenced this pull request May 27, 2024
…ce#1483)

Add macros to control whether to use the libc-builtin buffered printf
and the buffer size.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants