xref: /llvm-project/clang/test/Sema/attr-format-Float16.c (revision 442f67c8702a792a135d61765909b732827d6bf2)
1 // RUN: %clang_cc1 -fsyntax-only -verify -triple i686-linux-pc -target-feature +sse2 %s
2 // RUN: %clang_cc1 -fsyntax-only -verify -triple x86_64-linux-pc %s
3 // RUN: %clang_cc1 -fsyntax-only -verify -triple spir-unknown-unknown %s
4 // RUN: %clang_cc1 -fsyntax-only -verify -triple armv7a-linux-gnu %s
5 // RUN: %clang_cc1 -fsyntax-only -verify -triple aarch64-linux-gnu %s
6 // RUN: %clang_cc1 -fsyntax-only -verify -triple riscv32 %s
7 // RUN: %clang_cc1 -fsyntax-only -verify -triple riscv64 %s
8 
9 void a(const char *a, ...) __attribute__((format(printf, 1, 2)));    // no-error
10 
11 void b(char *a, _Float16 b) __attribute__((format(printf, 1, 2))); // expected-warning {{GCC requires a function with the 'format' attribute to be variadic}}
12 
call_no_default_promotion(void)13 void call_no_default_promotion(void) {
14   a("%f", (_Float16)1.0); // expected-warning{{format specifies type 'double' but the argument has type '_Float16'}}
15   b("%f", (_Float16)1.0); // expected-warning{{format specifies type 'double' but the argument has type '_Float16'}}
16 }
17