Index: clang-tidy/modernize/DeprecatedHeadersCheck.cpp =================================================================== --- clang-tidy/modernize/DeprecatedHeadersCheck.cpp +++ clang-tidy/modernize/DeprecatedHeadersCheck.cpp @@ -13,6 +13,7 @@ #include "clang/Lex/Preprocessor.h" #include "llvm/ADT/StringMap.h" +#include #include namespace clang { @@ -35,6 +36,7 @@ ClangTidyCheck &Check; LangOptions LangOpts; llvm::StringMap CStyledHeaderToCxx; + std::set DeleteHeader; }; } // namespace @@ -51,16 +53,23 @@ : Check(Check), LangOpts(LangOpts) { for (const auto &KeyValue : std::vector>( - {{"assert.h", "cassert"}, {"complex.h", "ccomplex"}, - {"ctype.h", "cctype"}, {"errno.h", "cerrno"}, - {"float.h", "cfloat"}, {"inttypes.h", "cinttypes"}, - {"iso646.h", "ciso646"}, {"limits.h", "climits"}, - {"locale.h", "clocale"}, {"math.h", "cmath"}, - {"setjmp.h", "csetjmp"}, {"signal.h", "csignal"}, - {"stdarg.h", "cstdarg"}, {"stddef.h", "cstddef"}, - {"stdint.h", "cstdint"}, {"stdio.h", "cstdio"}, - {"stdlib.h", "cstdlib"}, {"string.h", "cstring"}, - {"time.h", "ctime"}, {"wchar.h", "cwchar"}, + {{"assert.h", "cassert"}, + {"complex.h", "complex"}, + {"ctype.h", "cctype"}, + {"errno.h", "cerrno"}, + {"float.h", "cfloat"}, + {"limits.h", "climits"}, + {"locale.h", "clocale"}, + {"math.h", "cmath"}, + {"setjmp.h", "csetjmp"}, + {"signal.h", "csignal"}, + {"stdarg.h", "cstdarg"}, + {"stddef.h", "cstddef"}, + {"stdio.h", "cstdio"}, + {"stdlib.h", "cstdlib"}, + {"string.h", "cstring"}, + {"time.h", "ctime"}, + {"wchar.h", "cwchar"}, {"wctype.h", "cwctype"}})) { CStyledHeaderToCxx.insert(KeyValue); } @@ -69,13 +78,14 @@ for (const auto &KeyValue : std::vector>( {{"fenv.h", "cfenv"}, - {"stdalign.h", "cstdalign"}, - {"stdbool.h", "cstdbool"}, + {"stdint.h", "cstdint"}, + {"inttypes.h", "cinttypes"}, {"tgmath.h", "ctgmath"}, {"uchar.h", "cuchar"}})) { CStyledHeaderToCxx.insert(KeyValue); } } + DeleteHeader = {"stdalign.h", "stdbool.h", "iso646.h"}; } void IncludeModernizePPCallbacks::InclusionDirective( @@ -92,11 +102,16 @@ if (CStyledHeaderToCxx.count(FileName) != 0) { std::string Replacement = (llvm::Twine("<") + CStyledHeaderToCxx[FileName] + ">").str(); - Check.diag(FilenameRange.getBegin(), - "inclusion of deprecated C++ header '%0'; consider using '%1' instead") + Check.diag( + FilenameRange.getBegin(), + "inclusion of deprecated C++ header '%0'; consider using '%1' instead") << FileName << CStyledHeaderToCxx[FileName] << FixItHint::CreateReplacement(FilenameRange.getAsRange(), Replacement); + } else if (DeleteHeader.count(FileName) != 0) { + Check.diag(FilenameRange.getBegin(), + "including '%0' has no effect in C++; consider removing it") + << FileName << FixItHint::CreateRemoval(FilenameRange.getAsRange()); } } Index: docs/clang-tidy/checks/modernize-deprecated-headers.rst =================================================================== --- docs/clang-tidy/checks/modernize-deprecated-headers.rst +++ docs/clang-tidy/checks/modernize-deprecated-headers.rst @@ -4,10 +4,11 @@ ============================ Some headers from C library were deprecated in C++ and are no longer welcome in -C++ codebases. For more details refer to the C++ 14 Standard [depr.c.headers] -section. +C++ codebases. Some have no effect in C++. For more details refer to the C++ 14 +Standard [depr.c.headers] section. -This check replaces C standard library headers with their C++ alternatives. +This check replaces C standard library headers with their C++ alternatives and +removes redundant ones. Improtant note: the Standard doesn't guarantee that the C++ headers declare all the same functions in the global namespace. The check in its current form can @@ -20,15 +21,12 @@ * `` // deprecated since C++11 * `` * `` -* `` * `` * `` * `` * `` * `` -* `` // deprecated since C++11 * `` -* `` // deprecated since C++11 * `` * `` * `` @@ -42,4 +40,10 @@ If the specified standard is older than C++11 the check will only replace headers deprecated before C++11, otherwise -- every header that appeared in -the list. +previous list. + +These checks don't have effect in C++: + +* `` +* `` +* `` Index: test/clang-tidy/modernize-deprecated-headers-cxx03.cpp =================================================================== --- test/clang-tidy/modernize-deprecated-headers-cxx03.cpp +++ test/clang-tidy/modernize-deprecated-headers-cxx03.cpp @@ -5,8 +5,6 @@ #include #include #include -#include -#include #include #include #include @@ -14,7 +12,6 @@ #include #include #include -#include #include #include #include @@ -22,42 +19,47 @@ #include #include -// Headers deprecated since C++11: expect no diagnostics. -#include +// Headers that have no effect in C++; remove them #include #include +#include + +// Headers deprecated since C++11: expect no diagnostics. +#include +#include +#include #include #include -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'ccomplex' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider using 'ciso646' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead + + +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it // CHECK-FIXES: #include -// CHECK-FIXES: #include +// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include @@ -65,7 +67,6 @@ // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include @@ -78,8 +79,6 @@ #include "ctype.h" #include "errno.h" #include "float.h" -#include "inttypes.h" -#include "iso646.h" #include "limits.h" #include "locale.h" #include "math.h" @@ -87,7 +86,6 @@ #include "signal.h" #include "stdarg.h" #include "stddef.h" -#include "stdint.h" #include "stdio.h" #include "stdlib.h" #include "string.h" @@ -95,42 +93,47 @@ #include "wchar.h" #include "wctype.h" -// Headers deprecated since C++11; expect no diagnostics -#include "fenv.h" +// Headers that have no effect in C++; remove them #include "stdalign.h" #include "stdbool.h" +#include "iso646.h" + +// Headers deprecated since C++11; expect no diagnostics +#include "fenv.h" +#include "inttypes.h" +#include "stdint.h" #include "tgmath.h" #include "uchar.h" -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'ccomplex' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider using 'ciso646' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead + + +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-31]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it // CHECK-FIXES: #include -// CHECK-FIXES: #include +// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include @@ -138,7 +141,6 @@ // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include Index: test/clang-tidy/modernize-deprecated-headers-cxx11.cpp =================================================================== --- test/clang-tidy/modernize-deprecated-headers-cxx11.cpp +++ test/clang-tidy/modernize-deprecated-headers-cxx11.cpp @@ -7,15 +7,12 @@ #include #include #include -#include #include #include #include #include #include -#include #include -#include #include #include #include @@ -27,49 +24,53 @@ #include #include -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'ccomplex' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider using 'ciso646' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdalign.h'; consider using 'cstdalign' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdbool.h'; consider using 'cstdbool' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead +// Headers that have no effect in C++; remove them +#include +#include +#include + +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead [modernize-deprecated-headers] +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead + + +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it // CHECK-FIXES: #include -// CHECK-FIXES: #include +// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include @@ -88,15 +89,12 @@ #include "fenv.h" #include "float.h" #include "inttypes.h" -#include "iso646.h" #include "limits.h" #include "locale.h" #include "math.h" #include "setjmp.h" #include "signal.h" -#include "stdalign.h" #include "stdarg.h" -#include "stdbool.h" #include "stddef.h" #include "stdint.h" #include "stdio.h" @@ -108,49 +106,53 @@ #include "wchar.h" #include "wctype.h" -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'ccomplex' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'iso646.h'; consider using 'ciso646' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdalign.h'; consider using 'cstdalign' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdbool.h'; consider using 'cstdbool' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead -// CHECK-MESSAGES: :[[@LINE-27]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead +// Headers that have no effect in C++; remove them +#include "stdalign.h" +#include "stdbool.h" +#include "iso646.h" + +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'assert.h'; consider using 'cassert' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'complex.h'; consider using 'complex' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'ctype.h'; consider using 'cctype' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'errno.h'; consider using 'cerrno' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'fenv.h'; consider using 'cfenv' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'float.h'; consider using 'cfloat' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'inttypes.h'; consider using 'cinttypes' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'limits.h'; consider using 'climits' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'locale.h'; consider using 'clocale' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'math.h'; consider using 'cmath' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'setjmp.h'; consider using 'csetjmp' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'signal.h'; consider using 'csignal' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdarg.h'; consider using 'cstdarg' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stddef.h'; consider using 'cstddef' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdint.h'; consider using 'cstdint' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdio.h'; consider using 'cstdio' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'stdlib.h'; consider using 'cstdlib' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'string.h'; consider using 'cstring' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'tgmath.h'; consider using 'ctgmath' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'time.h'; consider using 'ctime' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'uchar.h'; consider using 'cuchar' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wchar.h'; consider using 'cwchar' instead +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: inclusion of deprecated C++ header 'wctype.h'; consider using 'cwctype' instead + + +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: including 'stdalign.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: including 'stdbool.h' has no effect in C++; consider removing it +// CHECK-MESSAGES: :[[@LINE-29]]:10: warning: including 'iso646.h' has no effect in C++; consider removing it // CHECK-FIXES: #include -// CHECK-FIXES: #include +// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include -// CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include // CHECK-FIXES: #include