35 lines · c
1// RUN: %check_clang_tidy %s cert-err33-c %t2 3typedef __SIZE_TYPE__ size_t;4void *aligned_alloc(size_t alignment, size_t size);5void test_aligned_alloc(void) {6 aligned_alloc(2, 10);7 // CHECK-MESSAGES: [[@LINE-1]]:3: warning: the value returned by this function should not be disregarded; neglecting it may lead to errors8 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning9}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 errors15 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning16}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 errors24 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning25}26 27int remove(const char *path);28int removeNonStdLibFunc(const char *path);29void test_remove(void) {30 remove("123");31 // CHECK-MESSAGES: [[@LINE-1]]:3: warning: the value returned by this function should not be disregarded; neglecting it may lead to errors32 // CHECK-MESSAGES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning33 removeNonStdLibFunc("123");34}35