1*89a1d03eSRichard // RUN: %check_clang_tidy -std=c++98 %s modernize-deprecated-headers %t -- -extra-arg-before=-isystem%S/Inputs/deprecated-headers 2*89a1d03eSRichard 3*89a1d03eSRichard #include <assert.h> 4*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] 5*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cassert>{{$}} 6*89a1d03eSRichard #include <complex.h> 7*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead 8*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <complex>{{$}} 9*89a1d03eSRichard #include <ctype.h> 10*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead 11*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cctype>{{$}} 12*89a1d03eSRichard #include <errno.h> 13*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead 14*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cerrno>{{$}} 15*89a1d03eSRichard #include <float.h> 16*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead 17*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cfloat>{{$}} 18*89a1d03eSRichard #include <limits.h> 19*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead 20*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <climits>{{$}} 21*89a1d03eSRichard #include <locale.h> 22*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead 23*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <clocale>{{$}} 24*89a1d03eSRichard #include <math.h> 25*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead 26*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cmath>{{$}} 27*89a1d03eSRichard #include <setjmp.h> 28*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead 29*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <csetjmp>{{$}} 30*89a1d03eSRichard #include <signal.h> 31*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead 32*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <csignal>{{$}} 33*89a1d03eSRichard #include <stdarg.h> 34*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead 35*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstdarg>{{$}} 36*89a1d03eSRichard #include <stddef.h> 37*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead 38*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstddef>{{$}} 39*89a1d03eSRichard #include <stdio.h> 40*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead 41*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstdio>{{$}} 42*89a1d03eSRichard #include <stdlib.h> 43*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead 44*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstdlib>{{$}} 45*89a1d03eSRichard #include <string.h> 46*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead 47*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstring>{{$}} 48*89a1d03eSRichard #include <time.h> 49*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead 50*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <ctime>{{$}} 51*89a1d03eSRichard #include <wchar.h> 52*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead 53*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cwchar>{{$}} 54*89a1d03eSRichard #include <wctype.h> 55*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead 56*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cwctype>{{$}} 57*89a1d03eSRichard 58*89a1d03eSRichard // Headers that have no effect in C++; remove them 59*89a1d03eSRichard #include <stdalign.h> // <stdalign.h> 60*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it 61*89a1d03eSRichard // CHECK-FIXES: {{^}}// <stdalign.h>{{$}} 62*89a1d03eSRichard #include <stdbool.h> // <stdbool.h> 63*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it 64*89a1d03eSRichard // CHECK-FIXES: {{^}}// <stdbool.h>{{$}} 65*89a1d03eSRichard #include <iso646.h> // <iso646.h> 66*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it 67*89a1d03eSRichard // CHECK-FIXES: {{^}}// <iso646.h>{{$}} 68*89a1d03eSRichard 69*89a1d03eSRichard // Headers deprecated since C++11: expect no diagnostics. 70*89a1d03eSRichard #include <fenv.h> 71*89a1d03eSRichard #include <inttypes.h> 72*89a1d03eSRichard #include <stdint.h> 73*89a1d03eSRichard #include <tgmath.h> 74*89a1d03eSRichard #include <uchar.h> 75*89a1d03eSRichard 76*89a1d03eSRichard 77*89a1d03eSRichard #include "assert.h" 78*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead 79*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cassert>{{$}} 80*89a1d03eSRichard #include "complex.h" 81*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead 82*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <complex>{{$}} 83*89a1d03eSRichard #include "ctype.h" 84*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead 85*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cctype>{{$}} 86*89a1d03eSRichard #include "errno.h" 87*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead 88*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cerrno>{{$}} 89*89a1d03eSRichard #include "float.h" 90*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead 91*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cfloat>{{$}} 92*89a1d03eSRichard #include "limits.h" 93*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead 94*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <climits>{{$}} 95*89a1d03eSRichard #include "locale.h" 96*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead 97*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <clocale>{{$}} 98*89a1d03eSRichard #include "math.h" 99*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead 100*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cmath>{{$}} 101*89a1d03eSRichard #include "setjmp.h" 102*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead 103*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <csetjmp>{{$}} 104*89a1d03eSRichard #include "signal.h" 105*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead 106*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <csignal>{{$}} 107*89a1d03eSRichard #include "stdarg.h" 108*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead 109*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstdarg>{{$}} 110*89a1d03eSRichard #include "stddef.h" 111*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead 112*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstddef>{{$}} 113*89a1d03eSRichard #include "stdio.h" 114*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead 115*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstdio>{{$}} 116*89a1d03eSRichard #include "stdlib.h" 117*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead 118*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstdlib>{{$}} 119*89a1d03eSRichard #include "string.h" 120*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead 121*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cstring>{{$}} 122*89a1d03eSRichard #include "time.h" 123*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead 124*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <ctime>{{$}} 125*89a1d03eSRichard #include "wchar.h" 126*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead 127*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cwchar>{{$}} 128*89a1d03eSRichard #include "wctype.h" 129*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead 130*89a1d03eSRichard // CHECK-FIXES: {{^}}#include <cwctype> 131*89a1d03eSRichard 132*89a1d03eSRichard // Headers that have no effect in C++; remove them 133*89a1d03eSRichard #include "stdalign.h" // "stdalign.h" 134*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it 135*89a1d03eSRichard // CHECK-FIXES: {{^}}// "stdalign.h"{{$}} 136*89a1d03eSRichard #include "stdbool.h" // "stdbool.h" 137*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it 138*89a1d03eSRichard // CHECK-FIXES: {{^}}// "stdbool.h"{{$}} 139*89a1d03eSRichard #include "iso646.h" // "iso646.h" 140*89a1d03eSRichard // CHECK-MESSAGES: :[[@LINE-1]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it 141*89a1d03eSRichard // CHECK-FIXES: {{^}}// "iso646.h"{{$}} 142*89a1d03eSRichard 143*89a1d03eSRichard // Headers deprecated since C++11; expect no diagnostics 144*89a1d03eSRichard #include "fenv.h" 145*89a1d03eSRichard #include "inttypes.h" 146*89a1d03eSRichard #include "stdint.h" 147*89a1d03eSRichard #include "tgmath.h" 148*89a1d03eSRichard #include "uchar.h" 149