]> git.ipfire.org Git - thirdparty/squid.git/blob - compat/stdvarargs.h
Source Format Enforcement (#532)
[thirdparty/squid.git] / compat / stdvarargs.h
1 /*
2 * Copyright (C) 1996-2020 The Squid Software Foundation and contributors
3 *
4 * Squid software is distributed under GPLv2+ license and includes
5 * contributions from numerous individuals and organizations.
6 * Please see the COPYING and CONTRIBUTORS files for details.
7 */
8
9 #ifndef _SQUID_STDVARARGS_H
10 #define _SQUID_STDVARARGS_H
11
12 /*
13 * va_* variables come from various places on different platforms.
14 * We provide a clean set of wrappers for the various operations
15 * Depending on what is available and needed.
16 */
17 #if defined(__cplusplus)
18 #include <cstdarg>
19
20 #else
21 #if HAVE_STDARG_H
22 #include <stdarg.h>
23 #define HAVE_STDARGS /* let's hope that works everywhere (mj) */
24 #define VA_LOCAL_DECL va_list ap;
25 #define VA_START(f) va_start(ap, f)
26 #define VA_SHIFT(v,t) ; /* no-op for ANSI */
27 #define VA_END va_end(ap)
28
29 #else /* !HAVE_STDARG_H */
30 #if HAVE_VARARGS_H
31 #include <varargs.h>
32 #undef HAVE_STDARGS
33 #define VA_LOCAL_DECL va_list ap;
34 #define VA_START(f) va_start(ap) /* f is ignored! */
35 #define VA_SHIFT(v,t) v = va_arg(ap,t)
36 #define VA_END va_end(ap)
37
38 #else /* !HAVE_VARARGS_H*/
39 #error XX **NO VARARGS ** XX
40 #endif /* HAVE_VARARGS_H */
41 #endif /* HAVE_STDARG_H */
42 #endif /* HAVE_CSTDARG */
43
44 /* Make sure syslog goes after stdarg/varargs */
45 #if HAVE_SYSLOG_H
46 #include <syslog.h>
47 #endif
48
49 #endif /* _SQUID_STDVARARGS_H */
50