Skip to content
Snippets Groups Projects
Commit 4f1eed75 authored by Alex Kiernan's avatar Alex Kiernan Committed by Tom Rini
Browse files

spl: Disable printf if not required


Now we have a guard for printf, disable it in the build if it's not
selected.

Signed-off-by: default avatarAlex Kiernan <alex.kiernan@gmail.com>
parent 14ad44ab
No related branches found
No related tags found
No related merge requests found
...@@ -37,9 +37,11 @@ void panic_str(const char *str) ...@@ -37,9 +37,11 @@ void panic_str(const char *str)
void panic(const char *fmt, ...) void panic(const char *fmt, ...)
{ {
#if CONFIG_IS_ENABLED(PRINTF)
va_list args; va_list args;
va_start(args, fmt); va_start(args, fmt);
vprintf(fmt, args); vprintf(fmt, args);
va_end(args); va_end(args);
#endif
panic_finish(); panic_finish();
} }
...@@ -23,11 +23,6 @@ struct printf_info { ...@@ -23,11 +23,6 @@ struct printf_info {
void (*putc)(struct printf_info *info, char ch); void (*putc)(struct printf_info *info, char ch);
}; };
static void putc_normal(struct printf_info *info, char ch)
{
putc(ch);
}
static void out(struct printf_info *info, char c) static void out(struct printf_info *info, char c)
{ {
*info->bf++ = c; *info->bf++ = c;
...@@ -321,6 +316,12 @@ abort: ...@@ -321,6 +316,12 @@ abort:
return 0; return 0;
} }
#if CONFIG_IS_ENABLED(PRINTF)
static void putc_normal(struct printf_info *info, char ch)
{
putc(ch);
}
int vprintf(const char *fmt, va_list va) int vprintf(const char *fmt, va_list va)
{ {
struct printf_info info; struct printf_info info;
...@@ -343,6 +344,7 @@ int printf(const char *fmt, ...) ...@@ -343,6 +344,7 @@ int printf(const char *fmt, ...)
return ret; return ret;
} }
#endif
static void putc_outstr(struct printf_info *info, char ch) static void putc_outstr(struct printf_info *info, char ch)
{ {
......
...@@ -783,6 +783,7 @@ int sprintf(char *buf, const char *fmt, ...) ...@@ -783,6 +783,7 @@ int sprintf(char *buf, const char *fmt, ...)
return i; return i;
} }
#if CONFIG_IS_ENABLED(PRINTF)
int printf(const char *fmt, ...) int printf(const char *fmt, ...)
{ {
va_list args; va_list args;
...@@ -824,7 +825,7 @@ int vprintf(const char *fmt, va_list args) ...@@ -824,7 +825,7 @@ int vprintf(const char *fmt, va_list args)
puts(printbuffer); puts(printbuffer);
return i; return i;
} }
#endif
void __assert_fail(const char *assertion, const char *file, unsigned line, void __assert_fail(const char *assertion, const char *file, unsigned line,
const char *function) const char *function)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment