Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 1 | /* |
| 2 | * This file is part of the coreboot project. |
Stefan Reinauer | 14e2277 | 2010-04-27 06:56:47 +0000 | [diff] [blame] | 3 | * |
Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 4 | * Copyright (C) 2009 coresystems GmbH |
| 5 | * |
Uwe Hermann | c70e9fc | 2010-02-15 23:10:19 +0000 | [diff] [blame] | 6 | * This program is free software; you can redistribute it and/or modify |
| 7 | * it under the terms of the GNU General Public License as published by |
| 8 | * the Free Software Foundation; version 2 of the License. |
Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 14 | */ |
| 15 | |
| 16 | #ifndef __CONSOLE_VTXPRINTF_H |
| 17 | #define __CONSOLE_VTXPRINTF_H |
| 18 | |
Stefan Reinauer | 68a564f | 2010-03-16 01:02:18 +0000 | [diff] [blame] | 19 | /* With GCC we use -nostdinc -ffreestanding to keep out system includes. |
| 20 | * Unfortunately this also gets us rid of the _compiler_ includes, like |
| 21 | * stdarg.h. To work around the issue, we define varargs directly here. |
| 22 | * On LLVM we can still just include stdarg.h. |
| 23 | */ |
| 24 | #ifdef __GNUC__ |
Lee Leahy | ae3fd34 | 2017-03-07 12:55:23 -0800 | [diff] [blame] | 25 | #define va_start(v, l) __builtin_va_start(v, l) |
Stefan Reinauer | 68a564f | 2010-03-16 01:02:18 +0000 | [diff] [blame] | 26 | #define va_end(v) __builtin_va_end(v) |
Lee Leahy | ae3fd34 | 2017-03-07 12:55:23 -0800 | [diff] [blame] | 27 | #define va_arg(v, l) __builtin_va_arg(v, l) |
Stefan Reinauer | 68a564f | 2010-03-16 01:02:18 +0000 | [diff] [blame] | 28 | typedef __builtin_va_list va_list; |
| 29 | #else |
Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 30 | #include <stdarg.h> |
Stefan Reinauer | 68a564f | 2010-03-16 01:02:18 +0000 | [diff] [blame] | 31 | #endif |
Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 32 | |
Kyösti Mälkki | b04e0ff | 2014-02-04 14:28:17 +0200 | [diff] [blame] | 33 | int vtxprintf(void (*tx_byte)(unsigned char byte, void *data), |
| 34 | const char *fmt, va_list args, void *data); |
Vladimir Serbinenko | f421b33 | 2013-11-26 21:43:05 +0100 | [diff] [blame] | 35 | |
Stefan Reinauer | 52fc6b1 | 2009-10-24 13:06:04 +0000 | [diff] [blame] | 36 | #endif |