summaryrefslogtreecommitdiff
path: root/include/printf.h
diff options
context:
space:
mode:
authorTom Hughes <tomhughes@chromium.org>2022-06-17 15:47:18 -0700
committerChromeos LUCI <chromeos-scoped@luci-project-accounts.iam.gserviceaccount.com>2022-07-19 17:55:21 +0000
commit1bc7945394c90dd2b00d8ea7c9201dc368904718 (patch)
tree77b11ce134657aec9efab0c8d23ab11aa26a7469 /include/printf.h
parent3eb29b6aa5a4e5e8c85046be789c6dd8d38afbaa (diff)
downloadchrome-ec-1bc7945394c90dd2b00d8ea7c9201dc368904718.tar.gz
tree: Move printf declarations to stdio.h
The "builtin" directory is EC's copy of the C standard library headers. Move the declarations for printf functions that are provided by the standard library to the "builtin" directory. This change makes it easier for future changes to optionally build with the C standard library instead of the standalone EC subset. BRANCH=none BUG=b:172020503, b:234181908, b:237823627 TEST=make buildall Signed-off-by: Tom Hughes <tomhughes@chromium.org> Change-Id: I4a5b4f8b98b972e86c4cca65d4910b5aa07ec524 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3712034 Reviewed-by: Jack Rosenthal <jrosenth@chromium.org>
Diffstat (limited to 'include/printf.h')
-rw-r--r--include/printf.h46
1 files changed, 1 insertions, 45 deletions
diff --git a/include/printf.h b/include/printf.h
index b63208f84d..f6330ff9c3 100644
--- a/include/printf.h
+++ b/include/printf.h
@@ -11,15 +11,9 @@
#include <stdarg.h> /* For va_list */
#include <stdbool.h>
#include <stddef.h> /* For size_t */
-#include "common.h"
#include "console.h"
-
-/* The declaration of snprintf is changed to crec_snprintf for Zephyr,
- * so include stdio.h from Zephyr.
- */
-#ifdef CONFIG_ZEPHYR
#include <stdio.h>
-#endif
+#include "common.h"
/**
* Buffer size in bytes large enough to hold the largest possible timestamp.
@@ -66,8 +60,6 @@
* - 'p' - pointer
*/
-#ifndef HIDE_EC_STDLIB
-
/**
* Print formatted output to a function, like vfprintf()
*
@@ -84,42 +76,6 @@
__stdlib_compat int vfnprintf(int (*addchar)(void *context, int c),
void *context, const char *format, va_list args);
-#ifndef CONFIG_ZEPHYR
-#define snprintf crec_snprintf
-#define vsnprintf crec_vsnprintf
-#endif
-
-/**
- * Print formatted outut to a string.
- *
- * Guarantees null-termination if size!=0.
- *
- * @param str Destination string
- * @param size Size of destination in bytes
- * @param format Format string
- * @return EC_SUCCESS, or EC_ERROR_OVERFLOW if the output was truncated.
- */
-__attribute__((__format__(__printf__, 3, 4)))
-__warn_unused_result __stdlib_compat int
-crec_snprintf(char *str, size_t size, const char *format, ...);
-
-/**
- * Print formatted output to a string.
- *
- * Guarantees null-termination if size!=0.
- *
- * @param str Destination string
- * @param size Size of destination in bytes
- * @param format Format string
- * @param args Parameters
- * @return The string length written to str, or a negative value on error.
- * The negative values can be -EC_ERROR_INVAL or -EC_ERROR_OVERFLOW.
- */
-__warn_unused_result __stdlib_compat int
-crec_vsnprintf(char *str, size_t size, const char *format, va_list args);
-
-#endif /* !HIDE_EC_STDLIB */
-
#ifdef TEST_BUILD
/**
* Converts @val to a string written in @buf. The value is converted from