stdio.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2024 ML!PA Consulting GmbH
3  *
4  * This file is subject to the terms and conditions of the GNU Lesser General
5  * Public License v2.1. See the file LICENSE in the top level directory for more
6  * details.
7  */
8 
9 #pragma once
10 
27 #include_next "stdio.h"
28 
29 #ifdef MODULE_STDIO_NULL
30 
31 #include <stdarg.h>
32 
33 #ifdef __cplusplus
34 extern "C"
35 {
36 #endif
37 
38 static inline int printf_null(const char *__restrict__ format, ...)
39 {
40  (void)format;
41  return 0;
42 }
43 
44 static inline int vprintf_null(const char *__restrict__ format, va_list ap)
45 {
46  (void)format;
47  (void)ap;
48  return 0;
49 }
50 
51 #undef perror
52 #undef putchar
53 #undef puts
54 #undef printf
55 #undef vprintf
56 
57 #define perror(s) (void)s
58 #define puts(s) (void)s
59 #define putchar(c) (void)c
60 #define printf(...) printf_null(__VA_ARGS__)
61 #define vprintf(format, ap) vprintf_null(format, ap)
62 
63 #ifdef __cplusplus
64 }
65 #endif
66 
67 #endif /* MODULE_STDIO_NULL */
68