brintos

brintos / llvm-project-archived public Read only

0
0
Text · 2.5 KiB · 7243827 Raw
73 lines · cpp
1 2// Copy the 'mylib.h' to a directory under the build directory. This is3// required, since the relative order of the emitted diagnostics depends on the4// absolute file paths which is sorted by clang-tidy prior emitting.5//6// RUN: mkdir -p %t/sys && mkdir -p %t/usr \7// RUN:   && cp %S/Inputs/deprecated-headers/mysystemlib.h %t/sys/mysystemlib.h \8// RUN:   && cp %S/Inputs/deprecated-headers/mylib.h       %t/usr/mylib.h9 10// RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \11// RUN:   -check-suffixes=DEFAULT \12// RUN:   --header-filter='.*' --system-headers \13// RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/deprecated-headers14 15// RUN: %check_clang_tidy -std=c++11 %s modernize-deprecated-headers %t \16// RUN:   -check-suffixes=DEFAULT,CHECK-HEADER-FILE \17// RUN:   -config="{CheckOptions: {modernize-deprecated-headers.CheckHeaderFile: 'true'}}" \18// RUN:   --header-filter='.*' --system-headers \19// RUN:   -- -I %t/usr -isystem %t/sys -isystem %S/Inputs/deprecated-headers20 21// REQUIRES: system-linux22 23#define EXTERN_C extern "C"24 25extern "C++" {26// We should still have the warnings here.27#include <stdbool.h>28// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]29}30 31#include <assert.h>32// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]33 34#include <stdbool.h>35// CHECK-MESSAGES-DEFAULT: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it [modernize-deprecated-headers]36 37#include <mysystemlib.h> // no-warning: Don't warn into system headers.38 39#include <mylib.h>40// CHECK-MESSAGES-CHECK-HEADER-FILE: mylib.h:1:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers]41 42namespace wrapping {43extern "C" {44#include <assert.h>  // no-warning45#include <mylib.h>   // no-warning46#include <stdbool.h> // no-warning47}48} // namespace wrapping49 50extern "C" {51namespace wrapped {52#include <assert.h>  // no-warning53#include <mylib.h>   // no-warning54#include <stdbool.h> // no-warning55} // namespace wrapped56}57 58namespace wrapping {59extern "C" {60namespace wrapped {61#include <assert.h>  // no-warning62#include <mylib.h>   // no-warning63#include <stdbool.h> // no-warning64} // namespace wrapped65}66} // namespace wrapping67 68EXTERN_C {69#include <assert.h>  // no-warning70#include <mylib.h>   // no-warning71#include <stdbool.h> // no-warning72}73