diff options
Diffstat (limited to 'test/Sema/enable_if.c')
-rw-r--r-- | test/Sema/enable_if.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/test/Sema/enable_if.c b/test/Sema/enable_if.c index 9125bfaf0f..b4bb2ecd0d 100644 --- a/test/Sema/enable_if.c +++ b/test/Sema/enable_if.c @@ -21,12 +21,12 @@ void test1() { size_t __strnlen_chk(const char *s, size_t requested_amount, size_t s_len); -size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate function}} +size_t strnlen(const char *s, size_t maxlen) __attribute__((overloadable)) __asm__("strnlen_real1"); __attribute__((always_inline)) -inline size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate function}} +inline size_t strnlen(const char *s, size_t maxlen) __attribute__((overloadable)) __attribute__((enable_if(__builtin_object_size(s, 0) != -1, "chosen when target buffer size is known"))) @@ -34,7 +34,7 @@ inline size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate return __strnlen_chk(s, maxlen, __builtin_object_size(s, 0)); } -size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate disabled: chosen when 'maxlen' is known to be less than or equal to the buffer size}} +size_t strnlen(const char *s, size_t maxlen) __attribute__((overloadable)) __attribute__((enable_if(__builtin_object_size(s, 0) != -1, "chosen when target buffer size is known"))) @@ -42,7 +42,7 @@ size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate disabl "chosen when 'maxlen' is known to be less than or equal to the buffer size"))) __asm__("strnlen_real2"); -size_t strnlen(const char *s, size_t maxlen) // expected-note{{candidate function has been explicitly made unavailable}} +size_t strnlen(const char *s, size_t maxlen) // expected-note {{'strnlen' has been explicitly marked unavailable here}} __attribute__((overloadable)) __attribute__((enable_if(__builtin_object_size(s, 0) != -1, "chosen when target buffer size is known"))) @@ -62,12 +62,12 @@ void test2(const char *s, int i) { strnlen(c, i); // CHECK: call {{.*}}strnlen_chk #ifndef CODEGEN - strnlen(c, 999); // expected-error{{call to unavailable function 'strnlen': 'maxlen' is larger than the buffer size}} + strnlen(c, 999); // expected-error{{'strnlen' is unavailable: 'maxlen' is larger than the buffer size}} #endif } -int isdigit(int c) __attribute__((overloadable)); // expected-note{{candidate function}} -int isdigit(int c) __attribute__((overloadable)) // expected-note{{candidate function has been explicitly made unavailable}} +int isdigit(int c) __attribute__((overloadable)); +int isdigit(int c) __attribute__((overloadable)) // expected-note {{'isdigit' has been explicitly marked unavailable here}} __attribute__((enable_if(c <= -1 || c > 255, "'c' must have the value of an unsigned char or EOF"))) __attribute__((unavailable("'c' must have the value of an unsigned char or EOF"))); @@ -75,13 +75,13 @@ void test3(int c) { isdigit(c); // expected-warning{{ignoring return value of function declared with pure attribute}} isdigit(10); // expected-warning{{ignoring return value of function declared with pure attribute}} #ifndef CODEGEN - isdigit(-10); // expected-error{{call to unavailable function 'isdigit': 'c' must have the value of an unsigned char or EOF}} + isdigit(-10); // expected-error{{'isdigit' is unavailable: 'c' must have the value of an unsigned char or EOF}} #endif } // Verify that the alternate spelling __enable_if__ works as well. -int isdigit2(int c) __attribute__((overloadable)); // expected-note{{candidate function}} -int isdigit2(int c) __attribute__((overloadable)) // expected-note{{candidate function has been explicitly made unavailable}} +int isdigit2(int c) __attribute__((overloadable)); +int isdigit2(int c) __attribute__((overloadable)) // expected-note {{'isdigit2' has been explicitly marked unavailable here}} __attribute__((__enable_if__(c <= -1 || c > 255, "'c' must have the value of an unsigned char or EOF"))) __attribute__((unavailable("'c' must have the value of an unsigned char or EOF"))); @@ -89,7 +89,7 @@ void test4(int c) { isdigit2(c); isdigit2(10); #ifndef CODEGEN - isdigit2(-10); // expected-error{{call to unavailable function 'isdigit2': 'c' must have the value of an unsigned char or EOF}} + isdigit2(-10); // expected-error{{'isdigit2' is unavailable: 'c' must have the value of an unsigned char or EOF}} #endif } |