spl: Disable printf if not required
authorAlex Kiernan <alex.kiernan@gmail.com>
Thu, 19 Apr 2018 04:32:55 +0000 (04:32 +0000)
committerTom Rini <trini@konsulko.com>
Sat, 28 Apr 2018 22:32:23 +0000 (18:32 -0400)
Now we have a guard for printf, disable it in the build if it's not
selected.

Signed-off-by: Alex Kiernan <alex.kiernan@gmail.com>
lib/panic.c
lib/tiny-printf.c
lib/vsprintf.c

index e2b8b74..0efa134 100644 (file)
@@ -37,9 +37,11 @@ void panic_str(const char *str)
 
 void panic(const char *fmt, ...)
 {
+#if CONFIG_IS_ENABLED(PRINTF)
        va_list args;
        va_start(args, fmt);
        vprintf(fmt, args);
        va_end(args);
+#endif
        panic_finish();
 }
index 0b04813..e29377e 100644 (file)
@@ -23,11 +23,6 @@ struct printf_info {
        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)
 {
        *info->bf++ = c;
@@ -321,6 +316,12 @@ abort:
        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)
 {
        struct printf_info info;
@@ -343,6 +344,7 @@ int printf(const char *fmt, ...)
 
        return ret;
 }
+#endif
 
 static void putc_outstr(struct printf_info *info, char ch)
 {
index 5f7a5f1..9f0ce8a 100644 (file)
@@ -783,6 +783,7 @@ int sprintf(char *buf, const char *fmt, ...)
        return i;
 }
 
+#if CONFIG_IS_ENABLED(PRINTF)
 int printf(const char *fmt, ...)
 {
        va_list args;
@@ -824,7 +825,7 @@ int vprintf(const char *fmt, va_list args)
        puts(printbuffer);
        return i;
 }
-
+#endif
 
 void __assert_fail(const char *assertion, const char *file, unsigned line,
                   const char *function)