]> git.ipfire.org Git - thirdparty/squid.git/blame - compat/stdvarargs.h
Maintenance: automate header guards 2/3 (#1655)
[thirdparty/squid.git] / compat / stdvarargs.h
CommitLineData
37be9888 1/*
b8ae064d 2 * Copyright (C) 1996-2023 The Squid Software Foundation and contributors
37be9888
AJ
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
ff9d9458
FC
9#ifndef SQUID_COMPAT_STDVARARGS_H
10#define SQUID_COMPAT_STDVARARGS_H
f04e1182
AJ
11
12/*
13 * va_* variables come from various places on different platforms.
dbb66306 14 * We provide a clean set of wrappers for the various operations
f04e1182
AJ
15 * Depending on what is available and needed.
16 */
074d6a40 17#if defined(__cplusplus)
dbb66306
AJ
18#include <cstdarg>
19
20#else
21#if HAVE_STDARG_H
f04e1182
AJ
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)
dbb66306 28
074d6a40 29#else /* !HAVE_STDARG_H */
dbb66306 30#if HAVE_VARARGS_H
f04e1182
AJ
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)
dbb66306 37
074d6a40 38#else /* !HAVE_VARARGS_H*/
f04e1182 39#error XX **NO VARARGS ** XX
dbb66306
AJ
40#endif /* HAVE_VARARGS_H */
41#endif /* HAVE_STDARG_H */
42#endif /* HAVE_CSTDARG */
f04e1182
AJ
43
44/* Make sure syslog goes after stdarg/varargs */
32d002cb 45#if HAVE_SYSLOG_H
f04e1182
AJ
46#include <syslog.h>
47#endif
48
ff9d9458 49#endif /* SQUID_COMPAT_STDVARARGS_H */
f53969cc 50