Skip to content

Commit 9e95699

Browse files
committed
[clang][Headers] Do not define varargs macros for __need___va_list
The glibc uses the define to avoid namespace polution on headers that requires variadic argument, where the inclusion of stdarg.h is required to obtain the va_list definition. For such cases only __gnuc_va_list is required. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D137268
1 parent e4e7bde commit 9e95699

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

clang/lib/Headers/stdarg.h

+11-6
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,16 @@
88
*/
99

1010
#ifndef __STDARG_H
11-
#define __STDARG_H
1211

12+
#ifndef __GNUC_VA_LIST
13+
#define __GNUC_VA_LIST
14+
typedef __builtin_va_list __gnuc_va_list;
15+
#endif
16+
17+
#ifdef __need___va_list
18+
#undef __need___va_list
19+
#else
20+
#define __STDARG_H
1321
#ifndef _VA_LIST
1422
typedef __builtin_va_list va_list;
1523
#define _VA_LIST
@@ -29,9 +37,6 @@ typedef __builtin_va_list va_list;
2937
#define va_copy(dest, src) __builtin_va_copy(dest, src)
3038
#endif
3139

32-
#ifndef __GNUC_VA_LIST
33-
#define __GNUC_VA_LIST 1
34-
typedef __builtin_va_list __gnuc_va_list;
35-
#endif
36-
3740
#endif /* __STDARG_H */
41+
42+
#endif /* not __STDARG_H */

compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp

+1
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#include <assert.h>
77
#include <signal.h>
8+
#include <stdarg.h>
89
#include <stdio.h>
910
#include <sys/time.h>
1011
#include <sys/wait.h>

0 commit comments

Comments
 (0)