This is an automated email from the ASF dual-hosted git repository. acassis pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/nuttx.git
commit 4ec55cb3ac514e4c406a3f28a776fe0be7c5f830 Author: Marco Casaroli <[email protected]> AuthorDate: Thu Nov 5 12:06:49 2026 +0100 libs/libc/stdio: Add the printf profiles. A choice of three profiles sets the defaults of the printf feature options: Minimal, Default and Full. Each option keeps its own prompt, so a user can add any feature to any profile. Default is the default of the choice, and the defaults of its options do not change, so no defconfig changes. Full turns on floating point, numbered arguments and locale. Minimal turns off floating point. Part of https://github.com/apache/nuttx/issues/21467 Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Marco Casaroli <[email protected]> --- libs/libc/locale/Kconfig | 2 +- libs/libc/stdio/Kconfig | 33 +++++++++++++++++++++++++++++++-- 2 files changed, 32 insertions(+), 3 deletions(-) diff --git a/libs/libc/locale/Kconfig b/libs/libc/locale/Kconfig index e4f1247943e..870f8c9201f 100644 --- a/libs/libc/locale/Kconfig +++ b/libs/libc/locale/Kconfig @@ -7,7 +7,7 @@ menu "Locale Support" config LIBC_LOCALE bool "Enable I18N (LOCALE) support" - default n + default LIBC_PRINTF_FULL ---help--- By default, i18n (locale) support is disabled. diff --git a/libs/libc/stdio/Kconfig b/libs/libc/stdio/Kconfig index 70b5bfe4ab8..f2e526df1e9 100644 --- a/libs/libc/stdio/Kconfig +++ b/libs/libc/stdio/Kconfig @@ -52,9 +52,38 @@ config NUNGET_CHARS Number of characters that can be buffered by ungetc() (Only if FILE_STREAM equals y) +choice + prompt "printf profile" + default LIBC_PRINTF_DEFAULT + ---help--- + A profile only sets the defaults of the printf feature options. + Each option keeps its own prompt, so any feature can be added to + or removed from any profile. + + printf() is safe with a correct call in every profile. A feature + that is off still reads its argument at the right size, so the + arguments after it stay correct. + +config LIBC_PRINTF_MINIMAL + bool "Minimal" + ---help--- + The smallest printf. It has less than the Default profile. + +config LIBC_PRINTF_DEFAULT + bool "Default" + ---help--- + The features that printf has always had by default. + +config LIBC_PRINTF_FULL + bool "Full" + ---help--- + All features. + +endchoice # printf profile + config LIBC_FLOATINGPOINT bool "Enable floating point in printf" - default !DEFAULT_SMALL && ARCH_FPU + default LIBC_PRINTF_FULL || (!DEFAULT_SMALL && ARCH_FPU && !LIBC_PRINTF_MINIMAL) depends on !LIBM_NONE ---help--- By default, floating point support in printf, sscanf, etc. is @@ -64,7 +93,7 @@ config LIBC_FLOATINGPOINT config LIBC_NUMBERED_ARGS bool "Enable numbered arguments in printf" - default n + default LIBC_PRINTF_FULL ---help--- Enables support for numbered arguments in printf.
