balazske updated this revision to Diff 383050.
balazske marked an inline comment as done.
balazske added a comment.

Removed remaining non-alias check line from list.rst.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D112409/new/

https://reviews.llvm.org/D112409

Files:
  clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
  clang-tools-extra/docs/ReleaseNotes.rst
  clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
  clang-tools-extra/docs/clang-tidy/checks/cert-err33-c.rst
  clang-tools-extra/docs/clang-tidy/checks/list.rst
  clang-tools-extra/test/clang-tidy/checkers/cert-err33-c.c

Index: clang-tools-extra/test/clang-tidy/checkers/cert-err33-c.c
===================================================================
--- /dev/null
+++ clang-tools-extra/test/clang-tidy/checkers/cert-err33-c.c
@@ -0,0 +1,1243 @@
+// RUN: %check_clang_tidy %s cert-err33-c %t
+
+// Check for every function in the list.
+// Arguments of these are not correct here, the checker does not check arguments.
+
+int aligned_alloc();
+void test_aligned_alloc() {
+  aligned_alloc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int asctime_s();
+void test_asctime_s() {
+  asctime_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int at_quick_exit();
+void test_at_quick_exit() {
+  at_quick_exit();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int atexit();
+void test_atexit() {
+  atexit();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int bsearch();
+void test_bsearch() {
+  bsearch();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int bsearch_s();
+void test_bsearch_s() {
+  bsearch_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int btowc();
+void test_btowc() {
+  btowc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int c16rtomb();
+void test_c16rtomb() {
+  c16rtomb();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int c32rtomb();
+void test_c32rtomb() {
+  c32rtomb();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int calloc();
+void test_calloc() {
+  calloc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int clock();
+void test_clock() {
+  clock();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int cnd_broadcast();
+void test_cnd_broadcast() {
+  cnd_broadcast();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int cnd_init();
+void test_cnd_init() {
+  cnd_init();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int cnd_signal();
+void test_cnd_signal() {
+  cnd_signal();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int cnd_timedwait();
+void test_cnd_timedwait() {
+  cnd_timedwait();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int cnd_wait();
+void test_cnd_wait() {
+  cnd_wait();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int ctime_s();
+void test_ctime_s() {
+  ctime_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fclose();
+void test_fclose() {
+  fclose();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fflush();
+void test_fflush() {
+  fflush();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fgetc();
+void test_fgetc() {
+  fgetc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fgetpos();
+void test_fgetpos() {
+  fgetpos();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fgets();
+void test_fgets() {
+  fgets();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fgetwc();
+void test_fgetwc() {
+  fgetwc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fopen();
+void test_fopen() {
+  fopen();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fopen_s();
+void test_fopen_s() {
+  fopen_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fprintf();
+void test_fprintf() {
+  fprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fprintf_s();
+void test_fprintf_s() {
+  fprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fputc();
+void test_fputc() {
+  fputc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fputs();
+void test_fputs() {
+  fputs();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fputwc();
+void test_fputwc() {
+  fputwc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fputws();
+void test_fputws() {
+  fputws();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fread();
+void test_fread() {
+  fread();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int freopen();
+void test_freopen() {
+  freopen();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int freopen_s();
+void test_freopen_s() {
+  freopen_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fscanf();
+void test_fscanf() {
+  fscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fscanf_s();
+void test_fscanf_s() {
+  fscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fseek();
+void test_fseek() {
+  fseek();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fsetpos();
+void test_fsetpos() {
+  fsetpos();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int ftell();
+void test_ftell() {
+  ftell();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fwprintf();
+void test_fwprintf() {
+  fwprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fwprintf_s();
+void test_fwprintf_s() {
+  fwprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fwrite();
+void test_fwrite() {
+  fwrite();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fwscanf();
+void test_fwscanf() {
+  fwscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int fwscanf_s();
+void test_fwscanf_s() {
+  fwscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int getc();
+void test_getc() {
+  getc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int getchar();
+void test_getchar() {
+  getchar();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int getenv();
+void test_getenv() {
+  getenv();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int getenv_s();
+void test_getenv_s() {
+  getenv_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int gets_s();
+void test_gets_s() {
+  gets_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int getwc();
+void test_getwc() {
+  getwc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int getwchar();
+void test_getwchar() {
+  getwchar();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int gmtime();
+void test_gmtime() {
+  gmtime();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int gmtime_s();
+void test_gmtime_s() {
+  gmtime_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int localtime();
+void test_localtime() {
+  localtime();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int localtime_s();
+void test_localtime_s() {
+  localtime_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int malloc();
+void test_malloc() {
+  malloc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mbrtoc16();
+void test_mbrtoc16() {
+  mbrtoc16();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mbrtoc32();
+void test_mbrtoc32() {
+  mbrtoc32();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mbsrtowcs();
+void test_mbsrtowcs() {
+  mbsrtowcs();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mbsrtowcs_s();
+void test_mbsrtowcs_s() {
+  mbsrtowcs_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mbstowcs();
+void test_mbstowcs() {
+  mbstowcs();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mbstowcs_s();
+void test_mbstowcs_s() {
+  mbstowcs_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int memchr();
+void test_memchr() {
+  memchr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mktime();
+void test_mktime() {
+  mktime();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mtx_init();
+void test_mtx_init() {
+  mtx_init();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mtx_lock();
+void test_mtx_lock() {
+  mtx_lock();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mtx_timedlock();
+void test_mtx_timedlock() {
+  mtx_timedlock();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mtx_trylock();
+void test_mtx_trylock() {
+  mtx_trylock();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int mtx_unlock();
+void test_mtx_unlock() {
+  mtx_unlock();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int printf_s();
+void test_printf_s() {
+  printf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int putc();
+void test_putc() {
+  putc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int putwc();
+void test_putwc() {
+  putwc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int raise();
+void test_raise() {
+  raise();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int realloc();
+void test_realloc() {
+  realloc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int remove();
+void test_remove() {
+  remove();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int rename();
+void test_rename() {
+  rename();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int scanf();
+void test_scanf() {
+  scanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int scanf_s();
+void test_scanf_s() {
+  scanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int setlocale();
+void test_setlocale() {
+  setlocale();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int setvbuf();
+void test_setvbuf() {
+  setvbuf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int signal();
+void test_signal() {
+  signal();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int snprintf();
+void test_snprintf() {
+  snprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int snprintf_s();
+void test_snprintf_s() {
+  snprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int sprintf();
+void test_sprintf() {
+  sprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int sprintf_s();
+void test_sprintf_s() {
+  sprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int sscanf();
+void test_sscanf() {
+  sscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int sscanf_s();
+void test_sscanf_s() {
+  sscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strchr();
+void test_strchr() {
+  strchr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strerror_s();
+void test_strerror_s() {
+  strerror_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strftime();
+void test_strftime() {
+  strftime();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strpbrk();
+void test_strpbrk() {
+  strpbrk();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strrchr();
+void test_strrchr() {
+  strrchr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strstr();
+void test_strstr() {
+  strstr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtod();
+void test_strtod() {
+  strtod();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtof();
+void test_strtof() {
+  strtof();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtoimax();
+void test_strtoimax() {
+  strtoimax();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtok();
+void test_strtok() {
+  strtok();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtok_s();
+void test_strtok_s() {
+  strtok_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtol();
+void test_strtol() {
+  strtol();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtold();
+void test_strtold() {
+  strtold();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtoll();
+void test_strtoll() {
+  strtoll();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtoul();
+void test_strtoul() {
+  strtoul();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtoull();
+void test_strtoull() {
+  strtoull();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strtoumax();
+void test_strtoumax() {
+  strtoumax();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int strxfrm();
+void test_strxfrm() {
+  strxfrm();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int swprintf();
+void test_swprintf() {
+  swprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int swprintf_s();
+void test_swprintf_s() {
+  swprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int swscanf();
+void test_swscanf() {
+  swscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int swscanf_s();
+void test_swscanf_s() {
+  swscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int thrd_create();
+void test_thrd_create() {
+  thrd_create();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int thrd_detach();
+void test_thrd_detach() {
+  thrd_detach();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int thrd_join();
+void test_thrd_join() {
+  thrd_join();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int thrd_sleep();
+void test_thrd_sleep() {
+  thrd_sleep();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int time();
+void test_time() {
+  time();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int timespec_get();
+void test_timespec_get() {
+  timespec_get();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tmpfile();
+void test_tmpfile() {
+  tmpfile();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tmpfile_s();
+void test_tmpfile_s() {
+  tmpfile_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tmpnam();
+void test_tmpnam() {
+  tmpnam();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tmpnam_s();
+void test_tmpnam_s() {
+  tmpnam_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tss_create();
+void test_tss_create() {
+  tss_create();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tss_get();
+void test_tss_get() {
+  tss_get();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int tss_set();
+void test_tss_set() {
+  tss_set();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int ungetc();
+void test_ungetc() {
+  ungetc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int ungetwc();
+void test_ungetwc() {
+  ungetwc();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfprintf();
+void test_vfprintf() {
+  vfprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfprintf_s();
+void test_vfprintf_s() {
+  vfprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfscanf(int, int);
+void test_vfscanf() {
+  vfscanf(0, 0);
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfscanf_s();
+void test_vfscanf_s() {
+  vfscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfwprintf();
+void test_vfwprintf() {
+  vfwprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfwprintf_s();
+void test_vfwprintf_s() {
+  vfwprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfwscanf();
+void test_vfwscanf() {
+  vfwscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vfwscanf_s();
+void test_vfwscanf_s() {
+  vfwscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vprintf_s();
+void test_vprintf_s() {
+  vprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vscanf(int, int);
+void test_vscanf() {
+  vscanf(0, 0);
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vscanf_s();
+void test_vscanf_s() {
+  vscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vsnprintf(int, int, int, int);
+void test_vsnprintf() {
+  vsnprintf(0, 0, 0, 0);
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vsnprintf_s();
+void test_vsnprintf_s() {
+  vsnprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vsprintf(int, int, int);
+void test_vsprintf() {
+  vsprintf(0, 0, 0);
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vsprintf_s(int, int, int);
+void test_vsprintf_s() {
+  vsprintf_s(0, 0, 0);
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vsscanf(int, int, int);
+void test_vsscanf() {
+  vsscanf(0, 0, 0);
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vsscanf_s();
+void test_vsscanf_s() {
+  vsscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vswprintf();
+void test_vswprintf() {
+  vswprintf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vswprintf_s();
+void test_vswprintf_s() {
+  vswprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vswscanf();
+void test_vswscanf() {
+  vswscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vswscanf_s();
+void test_vswscanf_s() {
+  vswscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vwprintf_s();
+void test_vwprintf_s() {
+  vwprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vwscanf();
+void test_vwscanf() {
+  vwscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int vwscanf_s();
+void test_vwscanf_s() {
+  vwscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcrtomb();
+void test_wcrtomb() {
+  wcrtomb();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcschr();
+void test_wcschr() {
+  wcschr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcsftime();
+void test_wcsftime() {
+  wcsftime();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcspbrk();
+void test_wcspbrk() {
+  wcspbrk();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcsrchr();
+void test_wcsrchr() {
+  wcsrchr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcsrtombs();
+void test_wcsrtombs() {
+  wcsrtombs();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcsrtombs_s();
+void test_wcsrtombs_s() {
+  wcsrtombs_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcsstr();
+void test_wcsstr() {
+  wcsstr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstod();
+void test_wcstod() {
+  wcstod();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstof();
+void test_wcstof() {
+  wcstof();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstoimax();
+void test_wcstoimax() {
+  wcstoimax();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstok();
+void test_wcstok() {
+  wcstok();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstok_s();
+void test_wcstok_s() {
+  wcstok_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstol();
+void test_wcstol() {
+  wcstol();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstold();
+void test_wcstold() {
+  wcstold();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstoll();
+void test_wcstoll() {
+  wcstoll();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstombs();
+void test_wcstombs() {
+  wcstombs();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstombs_s();
+void test_wcstombs_s() {
+  wcstombs_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstoul();
+void test_wcstoul() {
+  wcstoul();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstoull();
+void test_wcstoull() {
+  wcstoull();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcstoumax();
+void test_wcstoumax() {
+  wcstoumax();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wcsxfrm();
+void test_wcsxfrm() {
+  wcsxfrm();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wctob();
+void test_wctob() {
+  wctob();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wctrans();
+void test_wctrans() {
+  wctrans();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wctype();
+void test_wctype() {
+  wctype();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wmemchr();
+void test_wmemchr() {
+  wmemchr();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wprintf_s();
+void test_wprintf_s() {
+  wprintf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wscanf();
+void test_wscanf() {
+  wscanf();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
+
+int wscanf_s();
+void test_wscanf_s() {
+  wscanf_s();
+  // CHECK-NOTES: [[@LINE-1]]:3: warning: the value returned by this function should be used
+  // CHECK-NOTES: [[@LINE-2]]:3: note: cast the expression to void to silence this warning
+}
Index: clang-tools-extra/docs/clang-tidy/checks/list.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/list.rst
+++ clang-tools-extra/docs/clang-tidy/checks/list.rst
@@ -333,6 +333,7 @@
    `cert-dcl03-c <cert-dcl03-c.html>`_, `misc-static-assert <misc-static-assert.html>`_, "Yes"
    `cert-dcl16-c <cert-dcl16-c.html>`_, `readability-uppercase-literal-suffix <readability-uppercase-literal-suffix.html>`_, "Yes"
    `cert-dcl37-c <cert-dcl37-c.html>`_, `bugprone-reserved-identifier <bugprone-reserved-identifier.html>`_, "Yes"
+   `cert-err33-c <cert-err33-c.html>`_, `bugprone-unused-return-value <bugprone-unused-return-value.html>`_,
    `cert-dcl51-cpp <cert-dcl51-cpp.html>`_, `bugprone-reserved-identifier <bugprone-reserved-identifier.html>`_, "Yes"
    `cert-dcl54-cpp <cert-dcl54-cpp.html>`_, `misc-new-delete-overloads <misc-new-delete-overloads.html>`_,
    `cert-dcl59-cpp <cert-dcl59-cpp.html>`_, `google-build-namespaces <google-build-namespaces.html>`_,
Index: clang-tools-extra/docs/clang-tidy/checks/cert-err33-c.rst
===================================================================
--- /dev/null
+++ clang-tools-extra/docs/clang-tidy/checks/cert-err33-c.rst
@@ -0,0 +1,199 @@
+.. title:: clang-tidy - cert-err33-c
+
+cert-err33-c
+============
+
+Warns on unused function return values. Many of the standard library functions
+return a value that indicates if the call was successful. Ignoring the returned
+value can cause unexpected behavior if an error has occured. The following
+functions are checked:
+
+* aligned_alloc()
+* asctime_s()
+* at_quick_exit()
+* atexit()
+* bsearch()
+* bsearch_s()
+* btowc()
+* c16rtomb()
+* c32rtomb()
+* calloc()
+* clock()
+* cnd_broadcast()
+* cnd_init()
+* cnd_signal()
+* cnd_timedwait()
+* cnd_wait()
+* ctime_s()
+* fclose()
+* fflush()
+* fgetc()
+* fgetpos()
+* fgets()
+* fgetwc()
+* fopen()
+* fopen_s()
+* fprintf()
+* fprintf_s()
+* fputc()
+* fputs()
+* fputwc()
+* fputws()
+* fread()
+* freopen()
+* freopen_s()
+* fscanf()
+* fscanf_s()
+* fseek()
+* fsetpos()
+* ftell()
+* fwprintf()
+* fwprintf_s()
+* fwrite()
+* fwscanf()
+* fwscanf_s()
+* getc()
+* getchar()
+* getenv()
+* getenv_s()
+* gets_s()
+* getwc()
+* getwchar()
+* gmtime()
+* gmtime_s()
+* localtime()
+* localtime_s()
+* malloc()
+* mbrtoc16()
+* mbrtoc32()
+* mbsrtowcs()
+* mbsrtowcs_s()
+* mbstowcs()
+* mbstowcs_s()
+* memchr()
+* mktime()
+* mtx_init()
+* mtx_lock()
+* mtx_timedlock()
+* mtx_trylock()
+* mtx_unlock()
+* printf_s()
+* putc()
+* putwc()
+* raise()
+* realloc()
+* remove()
+* rename()
+* setlocale()
+* setvbuf()
+* scanf()
+* scanf_s()
+* signal()
+* snprintf()
+* snprintf_s()
+* sprintf()
+* sprintf_s()
+* sscanf()
+* sscanf_s()
+* strchr()
+* strerror_s()
+* strftime()
+* strpbrk()
+* strrchr()
+* strstr()
+* strtod()
+* strtof()
+* strtoimax()
+* strtok()
+* strtok_s()
+* strtol()
+* strtold()
+* strtoll()
+* strtoumax()
+* strtoul()
+* strtoull()
+* strxfrm()
+* swprintf()
+* swprintf_s()
+* swscanf()
+* swscanf_s()
+* thrd_create()
+* thrd_detach()
+* thrd_join()
+* thrd_sleep()
+* time()
+* timespec_get()
+* tmpfile()
+* tmpfile_s()
+* tmpnam()
+* tmpnam_s()
+* tss_create()
+* tss_get()
+* tss_set()
+* ungetc()
+* ungetwc()
+* vfprintf()
+* vfprintf_s()
+* vfscanf()
+* vfscanf_s()
+* vfwprintf()
+* vfwprintf_s()
+* vfwscanf()
+* vfwscanf_s()
+* vprintf_s()
+* vscanf()
+* vscanf_s()
+* vsnprintf()
+* vsnprintf_s()
+* vsprintf()
+* vsprintf_s()
+* vsscanf()
+* vsscanf_s()
+* vswprintf()
+* vswprintf_s()
+* vswscanf()
+* vswscanf_s()
+* vwprintf_s()
+* vwscanf()
+* vwscanf_s()
+* wcrtomb()
+* wcschr()
+* wcsftime()
+* wcspbrk()
+* wcsrchr()
+* wcsrtombs()
+* wcsrtombs_s()
+* wcsstr()
+* wcstod()
+* wcstof()
+* wcstoimax()
+* wcstok()
+* wcstok_s()
+* wcstol()
+* wcstold()
+* wcstoll()
+* wcstombs()
+* wcstombs_s()
+* wcstoumax()
+* wcstoul()
+* wcstoull()
+* wcsxfrm()
+* wctob()
+* wctrans()
+* wctype()
+* wmemchr()
+* wprintf_s()
+* wscanf()
+* wscanf_s()
+
+This check is an alias of check `bugprone-unused-return-value <bugprone-unused-return-value.html>`_
+with a fixed set of functions.
+
+The check corresponds to a part of CERT C Coding Standard rule `ERR33-C.
+Detect and handle standard library errors
+<https://wiki.sei.cmu.edu/confluence/display/c/ERR33-C.+Detect+and+handle+standard+library+errors>`_.
+The list of checked functions is taken from the rule, with following exception:
+
+* The check can not differentiate if a function is called with ``NULL``
+  argument. Therefore the following functions are not checked:
+  ``mblen``, ``mbrlen``, ``mbrtowc``, ``mbtowc``, ``wctomb``, ``wctomb_s``
Index: clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
===================================================================
--- clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
+++ clang-tools-extra/docs/clang-tidy/checks/bugprone-unused-return-value.rst
@@ -45,3 +45,6 @@
    - ``std::basic_string::empty()`` and ``std::vector::empty()``. Not using the
      return value often indicates that the programmer confused the function with
      ``clear()``.
+
+`cert-err33-c <cert-err33-c.html>`_ is an alias of this check that checks a
+fixed and large set of standard library functions.
Index: clang-tools-extra/docs/ReleaseNotes.rst
===================================================================
--- clang-tools-extra/docs/ReleaseNotes.rst
+++ clang-tools-extra/docs/ReleaseNotes.rst
@@ -103,6 +103,11 @@
 New check aliases
 ^^^^^^^^^^^^^^^^^
 
+- New alias :doc:`cert-err33-c
+  <clang-tidy/checks/cert-err33-c>` to
+  :doc:`bugprone-unused-return-value
+  <clang-tidy/checks/bugprone-unused-return-value>` was added.
+
 - New alias :doc:`cert-exp42-c
   <clang-tidy/checks/cert-exp42-c>` to
   :doc:`bugprone-suspicious-memory-comparison
Index: clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
===================================================================
--- clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
+++ clang-tools-extra/clang-tidy/cert/CERTTidyModule.cpp
@@ -16,6 +16,7 @@
 #include "../bugprone/SpuriouslyWakeUpFunctionsCheck.h"
 #include "../bugprone/SuspiciousMemoryComparisonCheck.h"
 #include "../bugprone/UnhandledSelfAssignmentCheck.h"
+#include "../bugprone/UnusedReturnValueCheck.h"
 #include "../concurrency/ThreadCanceltypeAsynchronousCheck.h"
 #include "../google/UnnamedNamespaceInHeaderCheck.h"
 #include "../misc/NewDeleteOverloadsCheck.h"
@@ -39,6 +40,193 @@
 #include "ThrownExceptionTypeCheck.h"
 #include "VariadicFunctionDefCheck.h"
 
+namespace {
+
+// Checked functions for cert-err33-c.
+// The following functions are deliberately excluded because they can be called
+// with NULL argument and in this case the check is not applicable:
+// `mblen, mbrlen, mbrtowc, mbtowc, wctomb, wctomb_s`.
+// FIXME: The check can be improved to handle such cases.
+const llvm::StringRef CertErr33CCheckedFunctions = "::aligned_alloc;"
+                                                   "::asctime_s;"
+                                                   "::at_quick_exit;"
+                                                   "::atexit;"
+                                                   "::bsearch;"
+                                                   "::bsearch_s;"
+                                                   "::btowc;"
+                                                   "::c16rtomb;"
+                                                   "::c32rtomb;"
+                                                   "::calloc;"
+                                                   "::clock;"
+                                                   "::cnd_broadcast;"
+                                                   "::cnd_init;"
+                                                   "::cnd_signal;"
+                                                   "::cnd_timedwait;"
+                                                   "::cnd_wait;"
+                                                   "::ctime_s;"
+                                                   "::fclose;"
+                                                   "::fflush;"
+                                                   "::fgetc;"
+                                                   "::fgetpos;"
+                                                   "::fgets;"
+                                                   "::fgetwc;"
+                                                   "::fopen;"
+                                                   "::fopen_s;"
+                                                   "::fprintf;"
+                                                   "::fprintf_s;"
+                                                   "::fputc;"
+                                                   "::fputs;"
+                                                   "::fputwc;"
+                                                   "::fputws;"
+                                                   "::fread;"
+                                                   "::freopen;"
+                                                   "::freopen_s;"
+                                                   "::fscanf;"
+                                                   "::fscanf_s;"
+                                                   "::fseek;"
+                                                   "::fsetpos;"
+                                                   "::ftell;"
+                                                   "::fwprintf;"
+                                                   "::fwprintf_s;"
+                                                   "::fwrite;"
+                                                   "::fwscanf;"
+                                                   "::fwscanf_s;"
+                                                   "::getc;"
+                                                   "::getchar;"
+                                                   "::getenv;"
+                                                   "::getenv_s;"
+                                                   "::gets_s;"
+                                                   "::getwc;"
+                                                   "::getwchar;"
+                                                   "::gmtime;"
+                                                   "::gmtime_s;"
+                                                   "::localtime;"
+                                                   "::localtime_s;"
+                                                   "::malloc;"
+                                                   "::mbrtoc16;"
+                                                   "::mbrtoc32;"
+                                                   "::mbsrtowcs;"
+                                                   "::mbsrtowcs_s;"
+                                                   "::mbstowcs;"
+                                                   "::mbstowcs_s;"
+                                                   "::memchr;"
+                                                   "::mktime;"
+                                                   "::mtx_init;"
+                                                   "::mtx_lock;"
+                                                   "::mtx_timedlock;"
+                                                   "::mtx_trylock;"
+                                                   "::mtx_unlock;"
+                                                   "::printf_s;"
+                                                   "::putc;"
+                                                   "::putwc;"
+                                                   "::raise;"
+                                                   "::realloc;"
+                                                   "::remove;"
+                                                   "::rename;"
+                                                   "::scanf;"
+                                                   "::scanf_s;"
+                                                   "::setlocale;"
+                                                   "::setvbuf;"
+                                                   "::signal;"
+                                                   "::snprintf;"
+                                                   "::snprintf_s;"
+                                                   "::sprintf;"
+                                                   "::sprintf_s;"
+                                                   "::sscanf;"
+                                                   "::sscanf_s;"
+                                                   "::strchr;"
+                                                   "::strerror_s;"
+                                                   "::strftime;"
+                                                   "::strpbrk;"
+                                                   "::strrchr;"
+                                                   "::strstr;"
+                                                   "::strtod;"
+                                                   "::strtof;"
+                                                   "::strtoimax;"
+                                                   "::strtok;"
+                                                   "::strtok_s;"
+                                                   "::strtol;"
+                                                   "::strtold;"
+                                                   "::strtoll;"
+                                                   "::strtoul;"
+                                                   "::strtoull;"
+                                                   "::strtoumax;"
+                                                   "::strxfrm;"
+                                                   "::swprintf;"
+                                                   "::swprintf_s;"
+                                                   "::swscanf;"
+                                                   "::swscanf_s;"
+                                                   "::thrd_create;"
+                                                   "::thrd_detach;"
+                                                   "::thrd_join;"
+                                                   "::thrd_sleep;"
+                                                   "::time;"
+                                                   "::timespec_get;"
+                                                   "::tmpfile;"
+                                                   "::tmpfile_s;"
+                                                   "::tmpnam;"
+                                                   "::tmpnam_s;"
+                                                   "::tss_create;"
+                                                   "::tss_get;"
+                                                   "::tss_set;"
+                                                   "::ungetc;"
+                                                   "::ungetwc;"
+                                                   "::vfprintf;"
+                                                   "::vfprintf_s;"
+                                                   "::vfscanf;"
+                                                   "::vfscanf_s;"
+                                                   "::vfwprintf;"
+                                                   "::vfwprintf_s;"
+                                                   "::vfwscanf;"
+                                                   "::vfwscanf_s;"
+                                                   "::vprintf_s;"
+                                                   "::vscanf;"
+                                                   "::vscanf_s;"
+                                                   "::vsnprintf;"
+                                                   "::vsnprintf_s;"
+                                                   "::vsprintf;"
+                                                   "::vsprintf_s;"
+                                                   "::vsscanf;"
+                                                   "::vsscanf_s;"
+                                                   "::vswprintf;"
+                                                   "::vswprintf_s;"
+                                                   "::vswscanf;"
+                                                   "::vswscanf_s;"
+                                                   "::vwprintf_s;"
+                                                   "::vwscanf;"
+                                                   "::vwscanf_s;"
+                                                   "::wcrtomb;"
+                                                   "::wcschr;"
+                                                   "::wcsftime;"
+                                                   "::wcspbrk;"
+                                                   "::wcsrchr;"
+                                                   "::wcsrtombs;"
+                                                   "::wcsrtombs_s;"
+                                                   "::wcsstr;"
+                                                   "::wcstod;"
+                                                   "::wcstof;"
+                                                   "::wcstoimax;"
+                                                   "::wcstok;"
+                                                   "::wcstok_s;"
+                                                   "::wcstol;"
+                                                   "::wcstold;"
+                                                   "::wcstoll;"
+                                                   "::wcstombs;"
+                                                   "::wcstombs_s;"
+                                                   "::wcstoul;"
+                                                   "::wcstoull;"
+                                                   "::wcstoumax;"
+                                                   "::wcsxfrm;"
+                                                   "::wctob;"
+                                                   "::wctrans;"
+                                                   "::wctype;"
+                                                   "::wmemchr;"
+                                                   "::wprintf_s;"
+                                                   "::wscanf;"
+                                                   "::wscanf_s;";
+
+} // namespace
+
 namespace clang {
 namespace tidy {
 namespace cert {
@@ -99,6 +287,10 @@
         "cert-dcl37-c");
     // ENV
     CheckFactories.registerCheck<CommandProcessorCheck>("cert-env33-c");
+    // ERR
+    CheckFactories.registerCheck<bugprone::UnusedReturnValueCheck>(
+        "cert-err33-c");
+    CheckFactories.registerCheck<StrToNumCheck>("cert-err34-c");
     // EXP
     CheckFactories.registerCheck<bugprone::SuspiciousMemoryComparisonCheck>(
         "cert-exp42-c");
@@ -108,8 +300,6 @@
         "cert-flp37-c");
     // FIO
     CheckFactories.registerCheck<misc::NonCopyableObjectsCheck>("cert-fio38-c");
-    // ERR
-    CheckFactories.registerCheck<StrToNumCheck>("cert-err34-c");
     // MSC
     CheckFactories.registerCheck<LimitedRandomnessCheck>("cert-msc30-c");
     CheckFactories.registerCheck<ProperlySeededRandomGeneratorCheck>(
@@ -131,6 +321,7 @@
     ClangTidyOptions Options;
     ClangTidyOptions::OptionMap &Opts = Options.CheckOptions;
     Opts["cert-dcl16-c.NewSuffixes"] = "L;LL;LU;LLU";
+    Opts["cert-err33-c.CheckedFunctions"] = CertErr33CCheckedFunctions;
     Opts["cert-oop54-cpp.WarnOnlyIfThisHasSuspiciousField"] = "false";
     Opts["cert-str34-c.DiagnoseSignedUnsignedCharComparisons"] = "false";
     return Options;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to