| 1 |
// PR c++/56302 |
| 2 |
// { dg-do compile } |
| 3 |
|
| 4 |
typedef __SIZE_TYPE__ size_t; |
| 5 |
# define STAP_SDT_ARG_CONSTRAINT nor |
| 6 |
# define _SDT_STRINGIFY(x) #x |
| 7 |
# define _SDT_ARG_CONSTRAINT_STRING(x) _SDT_STRINGIFY(x) |
| 8 |
# define _SDT_ARG(n, x) \ |
| 9 |
[_SDT_S##n] "n" ((_SDT_ARGSIGNED (x) ? 1 : -1) * (int) _SDT_ARGSIZE (x)), \ |
| 10 |
[_SDT_A##n] _SDT_ARG_CONSTRAINT_STRING (STAP_SDT_ARG_CONSTRAINT) (_SDT_ARGVAL (x)) |
| 11 |
#define _SDT_ARGARRAY(x) (__builtin_classify_type (x) == 14 \ |
| 12 |
|| __builtin_classify_type (x) == 5) |
| 13 |
# define _SDT_ARGSIGNED(x) (!_SDT_ARGARRAY (x) \ |
| 14 |
&& __sdt_type<__typeof (x)>::__sdt_signed) |
| 15 |
# define _SDT_ARGSIZE(x) (_SDT_ARGARRAY (x) \ |
| 16 |
? sizeof (void *) : sizeof (x)) |
| 17 |
# define _SDT_ARGVAL(x) (x) |
| 18 |
template<typename __sdt_T> |
| 19 |
struct __sdt_type |
| 20 |
{ |
| 21 |
static const bool __sdt_signed = false; |
| 22 |
}; |
| 23 |
#define __SDT_ALWAYS_SIGNED(T) \ |
| 24 |
template<> struct __sdt_type<T> { static const bool __sdt_signed = true; }; |
| 25 |
__SDT_ALWAYS_SIGNED(signed char) |
| 26 |
__SDT_ALWAYS_SIGNED(short) |
| 27 |
__SDT_ALWAYS_SIGNED(int) |
| 28 |
__SDT_ALWAYS_SIGNED(long) |
| 29 |
__SDT_ALWAYS_SIGNED(long long) |
| 30 |
template<typename __sdt_E> |
| 31 |
struct __sdt_type<__sdt_E[]> : public __sdt_type<__sdt_E *> {}; |
| 32 |
template<typename __sdt_E, size_t __sdt_N> |
| 33 |
struct __sdt_type<__sdt_E[__sdt_N]> : public __sdt_type<__sdt_E *> {}; |
| 34 |
|
| 35 |
struct S { char p[8]; }; |
| 36 |
|
| 37 |
void |
| 38 |
foo (const S &str) |
| 39 |
{ |
| 40 |
__asm__ __volatile__ ("" : : _SDT_ARG (0, &str)); |
| 41 |
} |