surround macro arguments with parentheses

This commit is contained in:
Daniel Pfeifer 2016-09-05 22:09:49 +02:00
parent bfdf1322e7
commit 1a9de8035c
9 changed files with 19 additions and 18 deletions

View File

@ -87,17 +87,17 @@ int cmCPackArchiveGenerator::addOneComponentToArchive(
*/ */
#define DECLARE_AND_OPEN_ARCHIVE(filename, archive) \ #define DECLARE_AND_OPEN_ARCHIVE(filename, archive) \
cmGeneratedFileStream gf; \ cmGeneratedFileStream gf; \
gf.Open(filename.c_str(), false, true); \ gf.Open((filename).c_str(), false, true); \
if (!GenerateHeader(&gf)) { \ if (!GenerateHeader(&gf)) { \
cmCPackLogger(cmCPackLog::LOG_ERROR, \ cmCPackLogger(cmCPackLog::LOG_ERROR, \
"Problem to generate Header for archive < " \ "Problem to generate Header for archive < " \
<< filename << ">." << std::endl); \ << (filename) << ">." << std::endl); \
return 0; \ return 0; \
} \ } \
cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \ cmArchiveWrite archive(gf, this->Compress, this->ArchiveFormat); \
if (!archive) { \ if (!(archive)) { \
cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \ cmCPackLogger(cmCPackLog::LOG_ERROR, "Problem to create archive < " \
<< filename << ">. ERROR =" << archive.GetError() \ << (filename) << ">. ERROR =" << (archive).GetError() \
<< std::endl); \ << std::endl); \
return 0; \ return 0; \
} }

View File

@ -366,11 +366,11 @@ int cmCTestBuildHandler::ProcessHandler()
regexes.clear(); \ regexes.clear(); \
cmCTestOptionalLog(this->CTest, DEBUG, \ cmCTestOptionalLog(this->CTest, DEBUG, \
this << "Add " #regexes << std::endl, this->Quiet); \ this << "Add " #regexes << std::endl, this->Quiet); \
for (it = strings.begin(); it != strings.end(); ++it) { \ for (it = (strings).begin(); it != (strings).end(); ++it) { \
cmCTestOptionalLog(this->CTest, DEBUG, \ cmCTestOptionalLog(this->CTest, DEBUG, \
"Add " #strings ": " << *it << std::endl, \ "Add " #strings ": " << *it << std::endl, \
this->Quiet); \ this->Quiet); \
regexes.push_back(it->c_str()); \ (regexes).push_back(it->c_str()); \
} }
cmCTestBuildHandlerPopulateRegexVector(this->CustomErrorMatches, cmCTestBuildHandlerPopulateRegexVector(this->CustomErrorMatches,
this->ErrorMatchRegex); this->ErrorMatchRegex);

View File

@ -25,9 +25,9 @@
#endif #endif
#define check_curl_result(result, errstr) \ #define check_curl_result(result, errstr) \
if (result != CURLE_OK && result != CURLE_NOT_BUILT_IN) { \ if ((result) != CURLE_OK && (result) != CURLE_NOT_BUILT_IN) { \
e += e.empty() ? "" : "\n"; \ e += e.empty() ? "" : "\n"; \
e += errstr; \ e += (errstr); \
e += ::curl_easy_strerror(result); \ e += ::curl_easy_strerror(result); \
} }

View File

@ -166,7 +166,7 @@ bool cmDocumentation::PrintRequestedDocumentation(std::ostream& os)
#define GET_OPT_ARGUMENT(target) \ #define GET_OPT_ARGUMENT(target) \
if ((i + 1 < argc) && !this->IsOption(argv[i + 1])) { \ if ((i + 1 < argc) && !this->IsOption(argv[i + 1])) { \
target = argv[i + 1]; \ (target) = argv[i + 1]; \
i = i + 1; \ i = i + 1; \
}; };

View File

@ -98,7 +98,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
{ \ { \
const char* value = mf->GetDefinition(cmakeDefinition); \ const char* value = mf->GetDefinition(cmakeDefinition); \
if (value) { \ if (value) { \
var = value; \ (var) = value; \
} \ } \
} }
@ -111,7 +111,7 @@ void cmGraphVizWriter::ReadSettings(const char* settingsFileName,
{ \ { \
const char* value = mf->GetDefinition(cmakeDefinition); \ const char* value = mf->GetDefinition(cmakeDefinition); \
if (value) { \ if (value) { \
var = mf->IsOn(cmakeDefinition); \ (var) = mf->IsOn(cmakeDefinition); \
} \ } \
} }

View File

@ -86,9 +86,10 @@ static bool isPolicyNewerThan(cmPolicies::PolicyID id, unsigned int majorV,
switch (id) { switch (id) {
#define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \ #define POLICY_CASE(ID, V_MAJOR, V_MINOR, V_PATCH) \
case cmPolicies::ID: \ case cmPolicies::ID: \
return ( \ return (majorV < (V_MAJOR) || \
majorV < V_MAJOR || (majorV == V_MAJOR && minorV + 1 < V_MINOR + 1) || \ (majorV == (V_MAJOR) && minorV + 1 < (V_MINOR) + 1) || \
(majorV == V_MAJOR && minorV == V_MINOR && patchV + 1 < V_PATCH + 1)); (majorV == (V_MAJOR) && minorV == (V_MINOR) && \
patchV + 1 < (V_PATCH) + 1));
CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE) CM_FOR_EACH_POLICY_ID_VERSION(POLICY_CASE)
#undef POLICY_CASE #undef POLICY_CASE
case cmPolicies::CMPCOUNT: case cmPolicies::CMPCOUNT:

View File

@ -1484,7 +1484,7 @@ void list_item_verbose(FILE* out, struct archive_entry* entry)
/* Format the time using 'ls -l' conventions. */ /* Format the time using 'ls -l' conventions. */
tim = archive_entry_mtime(entry); tim = archive_entry_mtime(entry);
#define HALF_YEAR (time_t)365 * 86400 / 2 #define HALF_YEAR ((time_t)365 * 86400 / 2)
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
/* Windows' strftime function does not support %e format. */ /* Windows' strftime function does not support %e format. */
#define DAY_FMT "%d" #define DAY_FMT "%d"

View File

@ -16,7 +16,7 @@
#include <string> #include <string>
#define cmFailed(m1, m2) \ #define cmFailed(m1, m2) \
std::cout << "FAILED: " << m1 << m2 << "\n"; \ std::cout << "FAILED: " << (m1) << (m2) << "\n"; \
failed = 1 failed = 1
int testGeneratedFileStream(int /*unused*/, char* /*unused*/ []) int testGeneratedFileStream(int /*unused*/, char* /*unused*/ [])

View File

@ -14,9 +14,9 @@
#include <iostream> #include <iostream>
#include <string> #include <string>
#define cmPassed(m) std::cout << "Passed: " << m << "\n" #define cmPassed(m) std::cout << "Passed: " << (m) << "\n"
#define cmFailed(m) \ #define cmFailed(m) \
std::cout << "FAILED: " << m << "\n"; \ std::cout << "FAILED: " << (m) << "\n"; \
failed = 1 failed = 1
int testSystemTools(int /*unused*/, char* /*unused*/ []) int testSystemTools(int /*unused*/, char* /*unused*/ [])