From 7262c11458b4b1131d9b3811f4a21c6b6afc2387 Mon Sep 17 00:00:00 2001 From: Rasmus Karlsson Date: Thu, 5 Jan 2017 16:42:26 +0100 Subject: [PATCH] the preprocessor command #warning is not standard. use #pragma message WARN("xD") to make it work on gcc and msvc --- chatterino.pro | 5 ++++- common.h | 15 +++++++++++++++ emotes.cpp | 2 +- ircmanager.cpp | 4 ++-- message.cpp | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) create mode 100644 common.h diff --git a/chatterino.pro b/chatterino.pro index 3c732a15d..ebc70e3ad 100644 --- a/chatterino.pro +++ b/chatterino.pro @@ -84,7 +84,10 @@ HEADERS += mainwindow.h \ message.h \ word.h \ link.h \ - fonts.h + fonts.h \ + common.h + +PRECOMPILED_HEADER = common.h FORMS += \ dialog.ui diff --git a/common.h b/common.h new file mode 100644 index 000000000..ca8695fc9 --- /dev/null +++ b/common.h @@ -0,0 +1,15 @@ +#ifndef COMMON_H +#define COMMON_H + +#define STRINGISE_IMPL(x) #x +#define STRINGISE(x) STRINGISE_IMPL(x) + +// Use: #pragma message WARN("My message") +#if _MSC_VER +# define FILE_LINE_LINK __FILE__ "(" STRINGISE(__LINE__) ") : " +# define WARN(exp) (FILE_LINE_LINK "WARNING: " exp) +#else//__GNUC__ - may need other defines for different compilers +# define WARN(exp) ("WARNING: " exp) +#endif + +#endif // COMMON_H diff --git a/emotes.cpp b/emotes.cpp index 457a951a0..24e59b166 100644 --- a/emotes.cpp +++ b/emotes.cpp @@ -16,7 +16,7 @@ Emotes::Emotes() LazyLoadedImage* Emotes::getCheerImage(long long amount, bool animated) { -#warning "xD" +#pragma message WARN("Implement Emotes::getCheerImage") // object image; // if (cheer >= 100000) diff --git a/ircmanager.cpp b/ircmanager.cpp index d2d00f5fe..75fb960e4 100644 --- a/ircmanager.cpp +++ b/ircmanager.cpp @@ -208,7 +208,7 @@ void IrcManager::addIgnoredUser(QString const &username) { QString errorMessage; if (!tryAddIgnoredUser(username, errorMessage)) { -#warning "xD" +#pragma message WARN("Implement IrcManager::addIgnoredUser") } } @@ -241,6 +241,6 @@ void IrcManager::removeIgnoredUser(QString const &username) { QString errorMessage; if (!tryRemoveIgnoredUser(username, errorMessage)) { -#warning "xD" +#pragma message WARN("TODO: Implement IrcManager::removeIgnoredUser") } } diff --git a/message.cpp b/message.cpp index e9f93a34e..0324844f9 100644 --- a/message.cpp +++ b/message.cpp @@ -70,7 +70,7 @@ Message::Message(const IrcPrivateMessage& ircMessage, const Channel& Channel) } // highlights -#warning "xD" +#pragma message WARN("xD") // color QColor usernameColor = ColorScheme::getInstance().SystemMessageColor;