1// RUN: %check_clang_tidy %s cert-err33-c %t
2
3typedef __SIZE_TYPE__ size_t;
4void *aligned_alloc(size_t alignment, size_t size);
5void test_aligned_alloc(void) {
6 aligned_alloc(alignment: 2, size: 10);
7 // CHECK-MESSAGES: [[@LINE-1]]:3: warning: the value returned by this function should not be disregarded; neglecting it may lead to errors
8 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
9}
10
11long strtol(const char *restrict nptr, char **restrict endptr, int base);
12void test_strtol(void) {
13 strtol("123", 0, 10);
14 // CHECK-MESSAGES: [[@LINE-1]]:3: warning: the value returned by this function should not be disregarded; neglecting it may lead to errors
15 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
16}
17
18typedef char wchar_t;
19int wscanf_s(const wchar_t *restrict format, ...);
20void test_wscanf_s(void) {
21 int Val;
22 wscanf_s("%i", &Val);
23 // CHECK-MESSAGES: [[@LINE-1]]:3: warning: the value returned by this function should not be disregarded; neglecting it may lead to errors
24 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
25}
26

source code of clang-tools-extra/test/clang-tidy/checkers/cert/err33-c.c