[PATCH] D137268: [clang][Headers] Do not define varargs macros for __need___va_list
Adhemerval Zanella via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Wed Nov 2 10:04:29 PDT 2022
zatrazz created this revision.
zatrazz added reviewers: jfb, eli.friedman, MaskRay.
Herald added subscribers: Enna1, StephenFan.
Herald added a project: All.
zatrazz requested review of this revision.
Herald added projects: clang, Sanitizers.
Herald added a subscriber: Sanitizers.
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.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137268
Files:
clang/lib/Headers/stdarg.h
compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
Index: compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
===================================================================
--- compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
+++ compiler-rt/test/sanitizer_common/TestCases/Linux/signal_send.cpp
@@ -5,6 +5,7 @@
#include <assert.h>
#include <signal.h>
+#include <stdarg.h>
#include <stdio.h>
#include <sys/time.h>
#include <sys/wait.h>
Index: clang/lib/Headers/stdarg.h
===================================================================
--- clang/lib/Headers/stdarg.h
+++ clang/lib/Headers/stdarg.h
@@ -8,7 +8,17 @@
*/
#ifndef __STDARG_H
+#ifndef __need___va_list
#define __STDARG_H
+#endif /* __need___va_list */
+#undef __need___va_list
+
+#ifndef __GNUC_VA_LIST
+#define __GNUC_VA_LIST 1
+typedef __builtin_va_list __gnuc_va_list;
+#endif
+
+#ifdef __STDARG_H
#ifndef _VA_LIST
typedef __builtin_va_list va_list;
@@ -29,9 +39,6 @@
#define va_copy(dest, src) __builtin_va_copy(dest, src)
#endif
-#ifndef __GNUC_VA_LIST
-#define __GNUC_VA_LIST 1
-typedef __builtin_va_list __gnuc_va_list;
-#endif
-
#endif /* __STDARG_H */
+
+#endif /* not __STDARG_H */
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137268.472667.patch
Type: text/x-patch
Size: 1163 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20221102/d250fc4b/attachment-0001.bin>
More information about the cfe-commits
mailing list