Use parentheses for macro arguments

This commit is contained in:
Jonas Kvinge
2020-06-15 00:33:47 +02:00
parent 56caab4461
commit a68c249d4e
5 changed files with 14 additions and 14 deletions

View File

@@ -32,8 +32,8 @@
#if defined(HAVE_STD_ATOMIC) #if defined(HAVE_STD_ATOMIC)
# include <atomic> # include <atomic>
# define ATOMIC_INT std::atomic_int # define ATOMIC_INT std::atomic_int
# define ATOMIC_INC(x) (++x) # define ATOMIC_INC(x) (++(x))
# define ATOMIC_DEC(x) (--x) # define ATOMIC_DEC(x) (--(x))
#elif defined(HAVE_GCC_ATOMIC) #elif defined(HAVE_GCC_ATOMIC)
# define ATOMIC_INT int # define ATOMIC_INT int
# define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1) # define ATOMIC_INC(x) __sync_add_and_fetch(&x, 1)
@@ -58,8 +58,8 @@
# define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1) # define ATOMIC_DEC(x) __sync_sub_and_fetch(&x, 1)
#else #else
# define ATOMIC_INT int # define ATOMIC_INT int
# define ATOMIC_INC(x) (++x) # define ATOMIC_INC(x) (++(x))
# define ATOMIC_DEC(x) (--x) # define ATOMIC_DEC(x) (--(x))
#endif #endif
namespace Strawberry_TagLib { namespace Strawberry_TagLib {

View File

@@ -43,9 +43,9 @@
*/ */
#if defined(QT_VERSION) && (QT_VERSION >= 0x040000) #if defined(QT_VERSION) && (QT_VERSION >= 0x040000)
# define QStringToTString(s) Strawberry_TagLib::TagLib::String(s.toUtf8().data(), Strawberry_TagLib::TagLib::String::UTF8) # define QStringToTString(s) Strawberry_TagLib::TagLib::String((s).toUtf8().data(), Strawberry_TagLib::TagLib::String::UTF8)
#else #else
# define QStringToTString(s) Strawberry_TagLib::TagLib::String(s.utf8().data(), Strawberry_TagLib::TagLib::String::UTF8) # define QStringToTString(s) Strawberry_TagLib::TagLib::String((s).utf8().data(), Strawberry_TagLib::TagLib::String::UTF8)
#endif #endif
/*! /*!
@@ -58,7 +58,7 @@
* *
*/ */
#define TStringToQString(s) QString::fromUtf8(s.toCString(true)) #define TStringToQString(s) QString::fromUtf8((s).toCString(true))
namespace Strawberry_TagLib { namespace Strawberry_TagLib {
namespace TagLib { namespace TagLib {

View File

@@ -34,8 +34,8 @@
class QIODevice; class QIODevice;
#define QStringFromStdString(x) QString::fromUtf8(x.data(), x.size()) #define QStringFromStdString(x) QString::fromUtf8((x).data(), (x).size())
#define DataCommaSizeFromQString(x) x.toUtf8().constData(), x.toUtf8().length() #define DataCommaSizeFromQString(x) (x).toUtf8().constData(), (x).toUtf8().length()
// Reads and writes uint32 length encoded protobufs to a socket. // Reads and writes uint32 length encoded protobufs to a socket.
// This base QObject is separate from AbstractMessageHandler because moc can't handle templated classes. // This base QObject is separate from AbstractMessageHandler because moc can't handle templated classes.

View File

@@ -1273,9 +1273,9 @@ bool Song::MergeFromSimpleMetaBundle(const Engine::SimpleMetaBundle &bundle) {
void Song::BindToQuery(QSqlQuery *query) const { void Song::BindToQuery(QSqlQuery *query) const {
#define strval(x) (x.isNull() ? "" : x) #define strval(x) ((x).isNull() ? "" : (x))
#define intval(x) (x <= 0 ? -1 : x) #define intval(x) ((x) <= 0 ? -1 : (x))
#define notnullintval(x) (x == -1 ? QVariant() : x) #define notnullintval(x) ((x) == -1 ? QVariant() : (x))
// Remember to bind these in the same order as kBindSpec // Remember to bind these in the same order as kBindSpec

View File

@@ -58,8 +58,8 @@ class MusicBrainzClient : public QObject {
bool operator<(const Result& other) const { bool operator<(const Result& other) const {
#define cmp(field) \ #define cmp(field) \
if (field < other.field) return true; \ if ((field) < other.field) return true; \
if (field > other.field) return false; if ((field) > other.field) return false;
cmp(track_); cmp(track_);
cmp(year_); cmp(year_);