Files
llvm-project/clang-tools-extra/test/clang-tidy/cert-variadic-function-def.cpp
Manuel Klimek b91bee06de Add %check_clang_tidy and %clang_tidy_diff.
With this, site specific lit configs can inject parameters into the
test scripts if they need site specific parameters.

Next up: enable check_clang_tidy to take a resource dir to enable
non-standard locations for builtin includes.

llvm-svn: 251010
2015-10-22 11:31:44 +00:00

25 lines
832 B
C++

// RUN: %check_clang_tidy %s cert-dcl50-cpp %t
// Variadic function definitions are diagnosed.
void f1(int, ...) {}
// CHECK-MESSAGES: :[[@LINE-1]]:6: warning: do not define a C-style variadic function; consider using a function parameter pack or currying instead [cert-dcl50-cpp]
// Variadic function *declarations* are not diagnosed.
void f2(int, ...); // ok
// Function parameter packs are good, however.
template <typename Arg, typename... Ts>
void f3(Arg F, Ts... Rest) {}
struct S {
void f(int, ...); // ok
void f1(int, ...) {}
// CHECK-MESSAGES: :[[@LINE-1]]:8: warning: do not define a C-style variadic function; consider using a function parameter pack or currying instead
};
// Function definitions that are extern "C" are good.
extern "C" void f4(int, ...) {} // ok
extern "C" {
void f5(int, ...) {} // ok
}