C++: Fix Qt dependency (Q_UNLIKELY) in 3rdparty/cplusplus

Change-Id: I37ffb657c9e042cc1c186895efd9c58fe6e332fd
Reviewed-by: Przemyslaw Gorszkowski <pgorszkowski@gmail.com>
Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
Nikolai Kosjar
2013-04-17 14:43:36 +02:00
committed by Erik Verbruggen
parent bf3d142418
commit b1bb093d15
2 changed files with 22 additions and 6 deletions

View File

@@ -24,9 +24,28 @@
#include <cstdlib> #include <cstdlib>
#include <cstddef> #include <cstddef>
#ifndef CPLUSPLUS_WITHOUT_QT #ifdef CPLUSPLUS_WITHOUT_QT
# ifndef CPLUSPLUS_UNLIKELY
# ifdef __GNUC__
# define CPLUSPLUS_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# else
# define CPLUSPLUS_UNLIKELY(expr) (expr)
# endif
# endif
# define CPLUSPLUS_EXPORT
#else
# include <qglobal.h> # include <qglobal.h>
# ifndef CPLUSPLUS_UNLIKELY
# ifdef Q_UNLIKELY
# define CPLUSPLUS_UNLIKELY(expr) Q_UNLIKELY(expr)
# else // pre 4.8.something
# ifdef __GCC__
# define CPLUSPLUS_UNLIKELY(expr) __builtin_expect(!!(expr), false)
# else
# define CPLUSPLUS_UNLIKELY(expr) (expr)
# endif
# endif
# endif
# if defined(CPLUSPLUS_BUILD_LIB) # if defined(CPLUSPLUS_BUILD_LIB)
# define CPLUSPLUS_EXPORT Q_DECL_EXPORT # define CPLUSPLUS_EXPORT Q_DECL_EXPORT
# elif defined(CPLUSPLUS_BUILD_STATIC_LIB) # elif defined(CPLUSPLUS_BUILD_STATIC_LIB)
@@ -34,8 +53,6 @@
# else # else
# define CPLUSPLUS_EXPORT Q_DECL_IMPORT # define CPLUSPLUS_EXPORT Q_DECL_IMPORT
# endif # endif
#else
# define CPLUSPLUS_EXPORT
#endif #endif
namespace CPlusPlus { namespace CPlusPlus {

View File

@@ -24,7 +24,6 @@
#include "CPlusPlusForwardDeclarations.h" #include "CPlusPlusForwardDeclarations.h"
#include "Token.h" #include "Token.h"
namespace CPlusPlus { namespace CPlusPlus {
class CPLUSPLUS_EXPORT Lexer class CPLUSPLUS_EXPORT Lexer
@@ -100,7 +99,7 @@ private:
inline void yyinp() inline void yyinp()
{ {
_yychar = *++_currentChar; _yychar = *++_currentChar;
if (Q_UNLIKELY(_yychar == '\n')) if (CPLUSPLUS_UNLIKELY(_yychar == '\n'))
pushLineStartOffset(); pushLineStartOffset();
} }