mirror of
https://github.com/capstone-engine/llvm-capstone.git
synced 2025-01-10 18:11:19 +00:00
202aac174a
Windows ARM indicates __va_start as a variadic function. However, the function itself is treated as having 4 formal arguments: - (out) pointer to the va_list - (in) address of the last named argument - (in) slot size for the type of the last argument - address of the last named argument The last argument does not seem to have any bearing on codegen, and thus is not explicitly type checked at this point. Unlike the previous handling for __va_start, it does not currently validate if the parameter is the last named parameter (it seems that MSVC currently accepts this). llvm-svn: 213595
23 lines
673 B
C++
23 lines
673 B
C++
// RUN: %clang_cc1 -triple thumbv7-windows -fms-compatibility -fsyntax-only %s -verify
|
|
// expected-no-diagnostics
|
|
|
|
extern "C" {
|
|
typedef char * va_list;
|
|
void __va_start(va_list *, ...);
|
|
}
|
|
|
|
int test___va_start(int i, ...) {
|
|
va_list ap;
|
|
__va_start(&ap, ( &reinterpret_cast<const char &>(i) ),
|
|
( (sizeof(i) + 4 - 1) & ~(4 - 1) ),
|
|
( &reinterpret_cast<const char &>(i) ));
|
|
return (*(int *)((ap += ( (sizeof(int) + 4 - 1) & ~(4 - 1) ) + ( ((va_list)0 - (ap)) & (__alignof(int) - 1) )) - ( (sizeof(int) + 4 - 1) & ~(4 - 1) )));
|
|
}
|
|
|
|
int builtin(int i, ...) {
|
|
__builtin_va_list ap;
|
|
__builtin_va_start(ap, i);
|
|
return __builtin_va_arg(ap, int);
|
|
}
|
|
|