Skip to content

Commit 09d4021

Browse files
committed
Fix compatibility for __builtin_stdarg_start
The __builtin_stdarg_start is the legacy spelling of __builtin_va_start. It should behave exactly the same, but for the last 9 years it would behave subtly different for diagnostics. Follow the change from 29ad95b to require custom type checking.
1 parent 9564f46 commit 09d4021

File tree

2 files changed

+8
-1
lines changed

2 files changed

+8
-1
lines changed

clang/include/clang/Basic/Builtins.def

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -472,7 +472,7 @@ BUILTIN(__builtin___NSStringMakeConstantString, "FC*cC*", "nc")
472472
BUILTIN(__builtin_va_start, "vA.", "nt")
473473
BUILTIN(__builtin_va_end, "vA", "n")
474474
BUILTIN(__builtin_va_copy, "vAA", "n")
475-
BUILTIN(__builtin_stdarg_start, "vA.", "n")
475+
BUILTIN(__builtin_stdarg_start, "vA.", "nt")
476476
BUILTIN(__builtin_assume_aligned, "v*vC*z.", "nc")
477477
BUILTIN(__builtin_bcmp, "ivC*vC*z", "Fn")
478478
BUILTIN(__builtin_bcopy, "vv*v*z", "n")

clang/test/SemaCXX/vararg-non-pod.cpp

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,13 @@ void t6(Foo somearg, ... ) {
164164
__builtin_va_start(list, somearg);
165165
}
166166

167+
// __builtin_stdarg_start is a compatibility alias for __builtin_va_start,
168+
// it should behave the same
169+
void t6b(Foo somearg, ... ) {
170+
__builtin_va_list list;
171+
__builtin_stdarg_start(list, somearg); // second argument to 'va_start' is not the last named parameter [-Wvarargs]
172+
}
173+
167174
void t7(int n, ...) {
168175
__builtin_va_list list;
169176
__builtin_va_start(list, n);

0 commit comments

Comments
 (0)