clang-tidy: add parentheses to macros

Signed-off-by: Rosen Penev <rosenp@gmail.com>
This commit is contained in:
Rosen Penev 2022-04-08 18:57:04 -07:00
parent cacb54eaba
commit 7a826ac529
5 changed files with 9 additions and 16 deletions

View File

@ -19,10 +19,6 @@
using namespace std;
#ifndef lengthof
#define lengthof(x) (sizeof(*x) / sizeof(x))
#endif
#if defined(_MSC_VER) || defined(__MINGW__)
#include <windows.h>
char* realpath(const char* file, char* path);

View File

@ -31,7 +31,7 @@
#endif
#include <iostream>
#define Safe(x) (x ? x : "unknown")
#define Safe(x) ((x) ? (x) : "unknown")
const char* optstring = ":hVvqfbuktTFa:Y:O:D:r:p:P:d:e:i:c:m:M:l:S:g:K:n:Q:";
// *****************************************************************************

View File

@ -37,7 +37,7 @@
#define WINAPI
using DWORD = unsigned long;
#define SOCKET_ERROR -1
#define SOCKET_ERROR (-1)
#define WSAEWOULDBLOCK EINPROGRESS
#define WSAENOTCONN EAGAIN
@ -56,10 +56,10 @@ static constexpr auto httpTemplate =
"%s" // $header
"\r\n";
#define white(c) ((c == ' ') || (c == '\t'))
#define white(c) (((c) == ' ') || ((c) == '\t'))
#define FINISH -999
#define OK(s) (200 <= s && s < 300)
#define FINISH (-999)
#define OK(s) (200 <= (s) && (s) < 300)
static constexpr std::array<const char*, 2> blankLines{
"\r\n\r\n", // this is the standard

View File

@ -12,8 +12,8 @@
#include <iostream>
// Shortcuts for the newTiffBinaryArray templates.
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&arrayCfg, std::size(arrayDef), arrayDef>)
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&arrayCfg>)
#define EXV_BINARY_ARRAY(arrayCfg, arrayDef) (newTiffBinaryArray0<&(arrayCfg), std::size(arrayDef), arrayDef>)
#define EXV_SIMPLE_BINARY_ARRAY(arrayCfg) (newTiffBinaryArray1<&(arrayCfg)>)
#define EXV_COMPLEX_BINARY_ARRAY(arraySet, cfgSelFct) (newTiffBinaryArray2<arraySet, std::size(arraySet), cfgSelFct>)
namespace Exiv2::Internal {

View File

@ -27,9 +27,6 @@
#include <unistd.h>
#endif
#ifndef lengthof
#define lengthof(x) sizeof(x) / sizeof(x[0])
#endif
#ifndef _MAX_PATH
#define _MAX_PATH 512
#endif
@ -126,10 +123,10 @@ static std::vector<std::string> getLoadedLibraries() {
// enumerate loaded libraries and determine path to executable
HMODULE handles[200];
DWORD cbNeeded;
if (EnumProcessModules(GetCurrentProcess(), handles, lengthof(handles), &cbNeeded)) {
if (EnumProcessModules(GetCurrentProcess(), handles, std::size(handles), &cbNeeded)) {
char szFilename[_MAX_PATH];
for (DWORD h = 0; h < cbNeeded / sizeof(handles[0]); h++) {
GetModuleFileNameA(handles[h], szFilename, lengthof(szFilename));
GetModuleFileNameA(handles[h], szFilename, std::size(szFilename));
std::string path(szFilename);
pushPath(path, libs, paths);
}