clang-tidy: fix bugprone-reserved-identifier
warnings
This commit is contained in:
parent
675d81be6c
commit
c826461d9c
@ -4,7 +4,6 @@ bugprone-*,\
|
||||
-bugprone-macro-parentheses,\
|
||||
-bugprone-misplaced-widening-cast,\
|
||||
-bugprone-narrowing-conversions,\
|
||||
-bugprone-reserved-identifier,\
|
||||
-bugprone-signed-char-misuse,\
|
||||
-bugprone-suspicious-include,\
|
||||
-bugprone-too-small-loop-variable,\
|
||||
|
@ -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
|
||||
};
|
||||
|
@ -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()) {
|
||||
|
@ -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
|
||||
|
||||
|
@ -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) {
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
||||
|
@ -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"
|
||||
|
@ -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"
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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:
|
||||
|
@ -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)))
|
||||
|
Loading…
Reference in New Issue
Block a user