summaryrefslogtreecommitdiffstats
path: root/clang/test
diff options
context:
space:
mode:
authorAaron Ballman <aaron@aaronballman.com>2018-06-19 14:59:11 +0000
committerAaron Ballman <aaron@aaronballman.com>2018-06-19 14:59:11 +0000
commitdd0e2b01ae58f3b5c9cf8adfd016c9d239458955 (patch)
treec6d2c36ea794259cf2324350d304eed408a6c352 /clang/test
parent68d5064beb0993fe3898f111fa6e7ff358bbe082 (diff)
downloadbcm5719-llvm-dd0e2b01ae58f3b5c9cf8adfd016c9d239458955.tar.gz
bcm5719-llvm-dd0e2b01ae58f3b5c9cf8adfd016c9d239458955.zip
Implement semantic checking for __builtin_signbit.
r242675 changed the signature for the signbit builtin but did not introduce proper semantic checking to ensure the arguments are as-expected. This patch groups the signbit builtin along with the other fp classification builtins. Fixes PR28172. llvm-svn: 335050
Diffstat (limited to 'clang/test')
-rw-r--r--clang/test/Sema/builtins.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/clang/test/Sema/builtins.c b/clang/test/Sema/builtins.c
index 7e999991f34..a831d030ef1 100644
--- a/clang/test/Sema/builtins.c
+++ b/clang/test/Sema/builtins.c
@@ -253,3 +253,26 @@ void test21(const int *ptr) {
__sync_fetch_and_add(ptr, 1); // expected-error{{address argument to atomic builtin cannot be const-qualified ('const int *' invalid)}}
__atomic_fetch_add(ptr, 1, 0); // expected-error {{address argument to atomic operation must be a pointer to non-const type ('const int *' invalid)}}
}
+
+void test22(void) {
+ (void)__builtin_signbit(); // expected-error{{too few arguments to function call, expected 1, have 0}}
+ (void)__builtin_signbit(1.0, 2.0, 3.0); // expected-error{{too many arguments to function call, expected 1, have 3}}
+ (void)__builtin_signbit(1); // expected-error {{floating point classification requires argument of floating point type (passed in 'int')}}
+ (void)__builtin_signbit(1.0);
+ (void)__builtin_signbit(1.0f);
+ (void)__builtin_signbit(1.0L);
+
+ (void)__builtin_signbitf(); // expected-error{{too few arguments to function call, expected 1, have 0}}
+ (void)__builtin_signbitf(1.0, 2.0, 3.0); // expected-error{{too many arguments to function call, expected 1, have 3}}
+ (void)__builtin_signbitf(1);
+ (void)__builtin_signbitf(1.0);
+ (void)__builtin_signbitf(1.0f);
+ (void)__builtin_signbitf(1.0L);
+
+ (void)__builtin_signbitl(); // expected-error{{too few arguments to function call, expected 1, have 0}}
+ (void)__builtin_signbitl(1.0, 2.0, 3.0); // expected-error{{too many arguments to function call, expected 1, have 3}}
+ (void)__builtin_signbitl(1);
+ (void)__builtin_signbitl(1.0);
+ (void)__builtin_signbitl(1.0f);
+ (void)__builtin_signbitl(1.0L);
+}
OpenPOWER on IntegriCloud