diff options
author | Ben Boeckel <ben.boeckel@kitware.com> | 2021-01-22 15:33:22 (GMT) |
---|---|---|
committer | Ben Boeckel <ben.boeckel@kitware.com> | 2021-01-27 13:45:44 (GMT) |
commit | c826461d9cd5d7a6cb32a09ccc44f9e2f3dd9dce (patch) | |
tree | fd692d5b557cea163005598b0c541b79a1c57069 /Source | |
parent | 675d81be6c728d21b78314f763ba060855b1366b (diff) | |
download | CMake-c826461d9cd5d7a6cb32a09ccc44f9e2f3dd9dce.zip CMake-c826461d9cd5d7a6cb32a09ccc44f9e2f3dd9dce.tar.gz CMake-c826461d9cd5d7a6cb32a09ccc44f9e2f3dd9dce.tar.bz2 |
clang-tidy: fix `bugprone-reserved-identifier` warnings
Diffstat (limited to 'Source')
-rw-r--r-- | Source/cmFileCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmGraphVizWriter.cxx | 34 | ||||
-rw-r--r-- | Source/cmLoadCommandCommand.cxx | 2 | ||||
-rw-r--r-- | Source/cmOutputConverter.cxx | 41 | ||||
-rw-r--r-- | Source/cmOutputConverter.h | 8 | ||||
-rw-r--r-- | Source/cmStandardLexer.h | 4 | ||||
-rw-r--r-- | Source/cmString.cxx | 1 | ||||
-rw-r--r-- | Source/cmStringCommand.cxx | 1 | ||||
-rw-r--r-- | Source/cmSystemTools.cxx | 2 | ||||
-rw-r--r-- | Source/cmTimestamp.cxx | 2 | ||||
-rw-r--r-- | Source/cmUVHandlePtr.h | 4 | ||||
-rw-r--r-- | Source/cmVersion.h | 8 |
12 files changed, 60 insertions, 49 deletions
diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index 9815d9d..b06eedb 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -334,7 +334,7 @@ bool HandleStringsCommand(std::vector<std::string> const& args, arg_limit_count, arg_length_minimum, arg_length_maximum, - arg__maximum, + arg_maximum, arg_regex, arg_encoding }; diff --git a/Source/cmGraphVizWriter.cxx b/Source/cmGraphVizWriter.cxx index 92ffe29..95cac20 100644 --- a/Source/cmGraphVizWriter.cxx +++ b/Source/cmGraphVizWriter.cxx @@ -230,7 +230,7 @@ void cmGraphVizWriter::ReadSettings( std::cout << "Reading GraphViz options file: " << inFileName << std::endl; -#define __set_if_set(var, cmakeDefinition) \ +#define set_if_set(var, cmakeDefinition) \ do { \ cmProp value = mf.GetDefinition(cmakeDefinition); \ if (value) { \ @@ -238,11 +238,11 @@ void cmGraphVizWriter::ReadSettings( } \ } while (false) - __set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME"); - __set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER"); - __set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX"); + set_if_set(this->GraphName, "GRAPHVIZ_GRAPH_NAME"); + set_if_set(this->GraphHeader, "GRAPHVIZ_GRAPH_HEADER"); + set_if_set(this->GraphNodePrefix, "GRAPHVIZ_NODE_PREFIX"); -#define __set_bool_if_set(var, cmakeDefinition) \ +#define set_bool_if_set(var, cmakeDefinition) \ do { \ cmProp value = mf.GetDefinition(cmakeDefinition); \ if (value) { \ @@ -250,20 +250,20 @@ void cmGraphVizWriter::ReadSettings( } \ } while (false) - __set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES"); - __set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS"); - __set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS"); - __set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS"); - __set_bool_if_set(this->GenerateForInterfaceLibs, "GRAPHVIZ_INTERFACE_LIBS"); - __set_bool_if_set(this->GenerateForObjectLibs, "GRAPHVIZ_OBJECT_LIBS"); - __set_bool_if_set(this->GenerateForUnknownLibs, "GRAPHVIZ_UNKNOWN_LIBS"); - __set_bool_if_set(this->GenerateForCustomTargets, "GRAPHVIZ_CUSTOM_TARGETS"); - __set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS"); - __set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET"); - __set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS"); + set_bool_if_set(this->GenerateForExecutables, "GRAPHVIZ_EXECUTABLES"); + set_bool_if_set(this->GenerateForStaticLibs, "GRAPHVIZ_STATIC_LIBS"); + set_bool_if_set(this->GenerateForSharedLibs, "GRAPHVIZ_SHARED_LIBS"); + set_bool_if_set(this->GenerateForModuleLibs, "GRAPHVIZ_MODULE_LIBS"); + set_bool_if_set(this->GenerateForInterfaceLibs, "GRAPHVIZ_INTERFACE_LIBS"); + set_bool_if_set(this->GenerateForObjectLibs, "GRAPHVIZ_OBJECT_LIBS"); + set_bool_if_set(this->GenerateForUnknownLibs, "GRAPHVIZ_UNKNOWN_LIBS"); + set_bool_if_set(this->GenerateForCustomTargets, "GRAPHVIZ_CUSTOM_TARGETS"); + set_bool_if_set(this->GenerateForExternals, "GRAPHVIZ_EXTERNAL_LIBS"); + set_bool_if_set(this->GeneratePerTarget, "GRAPHVIZ_GENERATE_PER_TARGET"); + set_bool_if_set(this->GenerateDependers, "GRAPHVIZ_GENERATE_DEPENDERS"); std::string ignoreTargetsRegexes; - __set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS"); + set_if_set(ignoreTargetsRegexes, "GRAPHVIZ_IGNORE_TARGETS"); this->TargetsToIgnoreRegex.clear(); if (!ignoreTargetsRegexes.empty()) { diff --git a/Source/cmLoadCommandCommand.cxx b/Source/cmLoadCommandCommand.cxx index adebe02..9c0b400 100644 --- a/Source/cmLoadCommandCommand.cxx +++ b/Source/cmLoadCommandCommand.cxx @@ -3,10 +3,12 @@ #if !defined(_WIN32) && !defined(__sun) // POSIX APIs are needed +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _POSIX_C_SOURCE 200809L #endif #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) // For isascii +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif diff --git a/Source/cmOutputConverter.cxx b/Source/cmOutputConverter.cxx index 359e9f5..ec54537 100644 --- a/Source/cmOutputConverter.cxx +++ b/Source/cmOutputConverter.cxx @@ -121,7 +121,7 @@ std::string cmOutputConverter::EscapeForShell( flags |= Shell_Flag_IsUnix; } - return Shell__GetArgument(str, flags); + return Shell_GetArgument(str, flags); } std::string cmOutputConverter::EscapeForCMake(cm::string_view str) @@ -150,7 +150,7 @@ std::string cmOutputConverter::EscapeForCMake(cm::string_view str) std::string cmOutputConverter::EscapeWindowsShellArgument(cm::string_view arg, int shell_flags) { - return Shell__GetArgument(arg, shell_flags); + return Shell_GetArgument(arg, shell_flags); } cmOutputConverter::FortranFormat cmOutputConverter::GetFortranFormat( @@ -226,12 +226,12 @@ use the caret character itself (^), use two in a row (^^). */ /* Some helpers to identify character classes */ -static bool Shell__CharIsWhitespace(char c) +static bool Shell_CharIsWhitespace(char c) { return ((c == ' ') || (c == '\t')); } -static bool Shell__CharNeedsQuotesOnUnix(char c) +static bool Shell_CharNeedsQuotesOnUnix(char c) { return ((c == '\'') || (c == '`') || (c == ';') || (c == '#') || (c == '&') || (c == '$') || (c == '(') || (c == ')') || (c == '~') || @@ -239,18 +239,18 @@ static bool Shell__CharNeedsQuotesOnUnix(char c) (c == '\\')); } -static bool Shell__CharNeedsQuotesOnWindows(char c) +static bool Shell_CharNeedsQuotesOnWindows(char c) { return ((c == '\'') || (c == '#') || (c == '&') || (c == '<') || (c == '>') || (c == '|') || (c == '^')); } -static bool Shell__CharIsMakeVariableName(char c) +static bool Shell_CharIsMakeVariableName(char c) { return c && (c == '_' || isalpha((static_cast<int>(c)))); } -bool cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags) +bool cmOutputConverter::Shell_CharNeedsQuotes(char c, int flags) { /* On Windows the built-in command shell echo never needs quotes. */ if (!(flags & Shell_Flag_IsUnix) && (flags & Shell_Flag_EchoWindows)) { @@ -258,30 +258,30 @@ bool cmOutputConverter::Shell__CharNeedsQuotes(char c, int flags) } /* On all platforms quotes are needed to preserve whitespace. */ - if (Shell__CharIsWhitespace(c)) { + if (Shell_CharIsWhitespace(c)) { return true; } if (flags & Shell_Flag_IsUnix) { /* On UNIX several special characters need quotes to preserve them. */ - if (Shell__CharNeedsQuotesOnUnix(c)) { + if (Shell_CharNeedsQuotesOnUnix(c)) { return true; } } else { /* On Windows several special characters need quotes to preserve them. */ - if (Shell__CharNeedsQuotesOnWindows(c)) { + if (Shell_CharNeedsQuotesOnWindows(c)) { return true; } } return false; } -cm::string_view::iterator cmOutputConverter::Shell__SkipMakeVariables( +cm::string_view::iterator cmOutputConverter::Shell_SkipMakeVariables( cm::string_view::iterator c, cm::string_view::iterator end) { while ((c != end && (c + 1) != end) && (*c == '$' && *(c + 1) == '(')) { cm::string_view::iterator skip = c + 2; - while ((skip != end) && Shell__CharIsMakeVariableName(*skip)) { + while ((skip != end) && Shell_CharIsMakeVariableName(*skip)) { ++skip; } if ((skip != end) && *skip == ')') { @@ -316,8 +316,8 @@ flag later when we understand applications of this better. */ #define KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES 0 -bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in, - int flags) +bool cmOutputConverter::Shell_ArgumentNeedsQuotes(cm::string_view in, + int flags) { /* The empty string needs quotes. */ if (in.empty()) { @@ -330,7 +330,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in, /* Look for $(MAKEVAR) syntax if requested. */ if (flags & Shell_Flag_AllowMakeVariables) { #if KWSYS_SYSTEM_SHELL_QUOTE_MAKE_VARIABLES - cm::string_view::iterator skip = Shell__SkipMakeVariables(cit, cend); + cm::string_view::iterator skip = Shell_SkipMakeVariables(cit, cend); if (skip != cit) { /* We need to quote make variable references to preserve the string with contents substituted in its place. */ @@ -338,7 +338,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in, } #else /* Skip over the make variable references if any are present. */ - cit = Shell__SkipMakeVariables(cit, cend); + cit = Shell_SkipMakeVariables(cit, cend); /* Stop if we have reached the end of the string. */ if (cit == cend) { @@ -348,7 +348,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in, } /* Check whether this character needs quotes. */ - if (Shell__CharNeedsQuotes(*cit, flags)) { + if (Shell_CharNeedsQuotes(*cit, flags)) { return true; } } @@ -364,8 +364,7 @@ bool cmOutputConverter::Shell__ArgumentNeedsQuotes(cm::string_view in, return false; } -std::string cmOutputConverter::Shell__GetArgument(cm::string_view in, - int flags) +std::string cmOutputConverter::Shell_GetArgument(cm::string_view in, int flags) { /* Output will be at least as long as input string. */ std::string out; @@ -375,7 +374,7 @@ std::string cmOutputConverter::Shell__GetArgument(cm::string_view in, int windows_backslashes = 0; /* Whether the argument must be quoted. */ - int needQuotes = Shell__ArgumentNeedsQuotes(in, flags); + int needQuotes = Shell_ArgumentNeedsQuotes(in, flags); if (needQuotes) { /* Add the opening quote for this argument. */ if (flags & Shell_Flag_WatcomQuote) { @@ -393,7 +392,7 @@ std::string cmOutputConverter::Shell__GetArgument(cm::string_view in, cit != cend; ++cit) { /* Look for $(MAKEVAR) syntax if requested. */ if (flags & Shell_Flag_AllowMakeVariables) { - cm::string_view::iterator skip = Shell__SkipMakeVariables(cit, cend); + cm::string_view::iterator skip = Shell_SkipMakeVariables(cit, cend); if (skip != cit) { /* Copy to the end of the make variable references. */ while (cit != skip) { diff --git a/Source/cmOutputConverter.h b/Source/cmOutputConverter.h index 655bc87..ac7e7a0 100644 --- a/Source/cmOutputConverter.h +++ b/Source/cmOutputConverter.h @@ -105,11 +105,11 @@ public: private: cmState* GetState() const; - static bool Shell__CharNeedsQuotes(char c, int flags); - static cm::string_view::iterator Shell__SkipMakeVariables( + static bool Shell_CharNeedsQuotes(char c, int flags); + static cm::string_view::iterator Shell_SkipMakeVariables( cm::string_view::iterator begin, cm::string_view::iterator end); - static bool Shell__ArgumentNeedsQuotes(cm::string_view in, int flags); - static std::string Shell__GetArgument(cm::string_view in, int flags); + static bool Shell_ArgumentNeedsQuotes(cm::string_view in, int flags); + static std::string Shell_GetArgument(cm::string_view in, int flags); private: cmStateSnapshot StateSnapshot; diff --git a/Source/cmStandardLexer.h b/Source/cmStandardLexer.h index 0203779..2689ba1 100644 --- a/Source/cmStandardLexer.h +++ b/Source/cmStandardLexer.h @@ -4,18 +4,22 @@ #if defined(__linux) /* Needed for glibc < 2.12 */ +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 600 #endif #if !defined(_WIN32) && !defined(__sun) /* POSIX APIs are needed */ +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _POSIX_C_SOURCE 200809L #endif #if defined(__sun) && defined(__GNUC__) && !defined(__cplusplus) /* C sources: for fileno and strdup */ +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 600 #endif #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) /* For isascii */ +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif diff --git a/Source/cmString.cxx b/Source/cmString.cxx index 8721242..aefaa64 100644 --- a/Source/cmString.cxx +++ b/Source/cmString.cxx @@ -1,5 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ +// NOLINTNEXTLINE(bugprone-reserved-identifier) #define _SCL_SECURE_NO_WARNINGS #include "cmString.hxx" diff --git a/Source/cmStringCommand.cxx b/Source/cmStringCommand.cxx index 0c8adc7..23fc3e0 100644 --- a/Source/cmStringCommand.cxx +++ b/Source/cmStringCommand.cxx @@ -1,5 +1,6 @@ /* Distributed under the OSI-approved BSD 3-Clause License. See accompanying file Copyright.txt or https://cmake.org/licensing for details. */ +// NOLINTNEXTLINE(bugprone-reserved-identifier) #define _SCL_SECURE_NO_WARNINGS #include "cmStringCommand.h" diff --git a/Source/cmSystemTools.cxx b/Source/cmSystemTools.cxx index 024356f..18c266f 100644 --- a/Source/cmSystemTools.cxx +++ b/Source/cmSystemTools.cxx @@ -3,11 +3,13 @@ #if !defined(_WIN32) && !defined(__sun) // POSIX APIs are needed +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _POSIX_C_SOURCE 200809L #endif #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ defined(__QNX__) // For isascii +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif diff --git a/Source/cmTimestamp.cxx b/Source/cmTimestamp.cxx index 7fb69bf..e03a567 100644 --- a/Source/cmTimestamp.cxx +++ b/Source/cmTimestamp.cxx @@ -3,11 +3,13 @@ #if !defined(_WIN32) && !defined(__sun) // POSIX APIs are needed +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _POSIX_C_SOURCE 200809L #endif #if defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) || \ defined(__QNX__) // For isascii +// NOLINTNEXTLINE(bugprone-reserved-identifier) # define _XOPEN_SOURCE 700 #endif diff --git a/Source/cmUVHandlePtr.h b/Source/cmUVHandlePtr.h index 356e227..8c5ad59 100644 --- a/Source/cmUVHandlePtr.h +++ b/Source/cmUVHandlePtr.h @@ -78,7 +78,7 @@ template <typename T> class uv_handle_ptr_base_ { protected: - template <typename _T> + template <typename U> friend class uv_handle_ptr_base_; /** @@ -160,7 +160,7 @@ inline uv_handle_ptr_base_<T>& uv_handle_ptr_base_<T>::operator=( template <typename T> class uv_handle_ptr_ : public uv_handle_ptr_base_<T> { - template <typename _T> + template <typename U> friend class uv_handle_ptr_; public: diff --git a/Source/cmVersion.h b/Source/cmVersion.h index 9072c9f..456428c 100644 --- a/Source/cmVersion.h +++ b/Source/cmVersion.h @@ -24,8 +24,8 @@ public: /* Encode with room for up to 1000 minor releases between major releases and to encode dates until the year 10000 in the patch level. */ -#define CMake_VERSION_ENCODE__BASE KWIML_INT_UINT64_C(100000000) +#define CMake_VERSION_ENCODE_BASE KWIML_INT_UINT64_C(100000000) #define CMake_VERSION_ENCODE(major, minor, patch) \ - ((((major)*1000u) * CMake_VERSION_ENCODE__BASE) + \ - (((minor) % 1000u) * CMake_VERSION_ENCODE__BASE) + \ - (((patch) % CMake_VERSION_ENCODE__BASE))) + ((((major)*1000u) * CMake_VERSION_ENCODE_BASE) + \ + (((minor) % 1000u) * CMake_VERSION_ENCODE_BASE) + \ + (((patch) % CMake_VERSION_ENCODE_BASE))) |