[SCM] smokegen packaging branch, master, updated. 6b53cbfbf7fb76a953413e9be38d9e93204959f8

David Palacio dpalacio-guest at alioth.debian.org
Fri Jun 24 21:39:14 UTC 2011


The following commit has been merged in the master branch:
commit 6b53cbfbf7fb76a953413e9be38d9e93204959f8
Author: David Palacio <dpalacio at orbitalibre.org>
Date:   Fri Jun 24 16:40:31 2011 -0500

    readd kdebindings patches
---
 .../fix_segfault_in_generator_on_armel.diff        |   26 +
 debian/patches/series                              |    3 +
 debian/patches/smokegen_load_system_defines.diff   |  612 ++++++++++++++++++++
 debian/patches/version_cppparser_library.diff      |   10 +
 4 files changed, 651 insertions(+), 0 deletions(-)

diff --git a/debian/patches/fix_segfault_in_generator_on_armel.diff b/debian/patches/fix_segfault_in_generator_on_armel.diff
new file mode 100644
index 0000000..7fbd11a
--- /dev/null
+++ b/debian/patches/fix_segfault_in_generator_on_armel.diff
@@ -0,0 +1,26 @@
+Patch by Sune Vuorela
+Fixes segfault seen on arm, but theoretically could happen more places.
+token_text can return a null pointer.
+Index: b/type_compiler.cpp
+===================================================================
+--- a/type_compiler.cpp
++++ b/type_compiler.cpp
+@@ -191,11 +191,13 @@
+ 
+ void TypeCompiler::visitPtrOperator(PtrOperatorAST* node)
+ {
+-    if (token_text(m_session->token_stream->kind(node->op))[0] == '*') {
+-        QPair<bool, bool> cv = m_visitor->parseCv(node->cv);
+-        pointerDepth.append(cv.first);
+-    } else if (token_text(m_session->token_stream->kind(node->op))[0] == '&') {
+-        isRef = true;
++    if(token_text(m_session->token_stream->kind(node->op))) {
++        if (token_text(m_session->token_stream->kind(node->op))[0] == '*') {
++            QPair<bool, bool> cv = m_visitor->parseCv(node->cv);
++            pointerDepth.append(cv.first);
++        } else if (token_text(m_session->token_stream->kind(node->op))[0] == '&') {
++            isRef = true;
++        }
+     }
+ }
+ 
diff --git a/debian/patches/series b/debian/patches/series
new file mode 100644
index 0000000..ca7c26c
--- /dev/null
+++ b/debian/patches/series
@@ -0,0 +1,3 @@
+fix_segfault_in_generator_on_armel.diff
+smokegen_load_system_defines.diff
+version_cppparser_library.diff
diff --git a/debian/patches/smokegen_load_system_defines.diff b/debian/patches/smokegen_load_system_defines.diff
new file mode 100644
index 0000000..4232fcf
--- /dev/null
+++ b/debian/patches/smokegen_load_system_defines.diff
@@ -0,0 +1,612 @@
+From: Modestas Vainius <modax at debian.org>
+Subject: get system #defines from current compiler
+Bug-Debian: http://bugs.debian.org/626631
+Forwarded: no
+Last-Update: 2011-05-13
+Origin: vendor
+
+Steal and port some setuphelpers code from the latest kdevelop (b3104e25) which
+dynamically gets system #defines from the current gcc and feeds them to
+smokegen macro preprocessor. This code replaces a couple of macros which were
+hardcoded in the preprocessor code but were insufficient in some cases (e.g.
+generator failed to generate proper code on kFreeBSD with eglibc >= 2.13, see
+build logs of kdebindings 4:4.4.5-6 [1]).
+
+While porting, KProcess was replaced by QProcess, kDebug() with qDebug(),
+adjusted include paths and setuphelpers functions were integrated into existing
+generator code. A few new interfaces had to be made to the pp-macro class to
+support some setuphelpers calls.
+
+[1] https://buildd.debian.org/status/fetch.php?pkg=kdebindings&arch=kfreebsd-amd64&ver=4%3A4.4.5-6&stamp=1304984309
+
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -22,6 +22,8 @@ set(generator_SRC
+     type_compiler.cpp
+     name_compiler.cpp
+     type.cpp
++    setuphelpers.cpp
++    setuphelpers_gcc.cpp
+ )
+ 
+ # force RPATH so that the binary is usable from within the build tree
+--- a/generatorpreprocessor.cpp
++++ b/generatorpreprocessor.cpp
+@@ -18,6 +18,7 @@
+ 
+ #include "generatorpreprocessor.h"
+ #include "generatorenvironment.h"
++#include "setuphelpers.h"
+ 
+ #include <rpp/pp-environment.h>
+ #include <rpp/pp-macro.h>
+@@ -38,74 +39,18 @@ Preprocessor::Preprocessor(const QList<Q
+     
+     // some basic definitions
+     rpp::pp_macro* exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__cplusplus");
+-    exportMacro->definition.append(IndexedString('1'));
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
+-
+-    exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__GNUC__");
+-    exportMacro->definition.append(IndexedString('4'));
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
+-
+-    exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__GNUC_MINOR__");
++    exportMacro->name = IndexedString("__SMOKEGEN_RUN__");
+     exportMacro->definition.append(IndexedString('1'));
+     exportMacro->function_like = false;
+     exportMacro->variadics = false;
+     m_topBlock->setMacro(exportMacro);
+ 
+-    exportMacro = new rpp::pp_macro;
+-#if defined(Q_OS_LINUX)
+-    exportMacro->name = IndexedString("__linux__");
+-#elif defined(Q_OS_WIN32)
+-    exportMacro->name = IndexedString("WIN32");
+-#elif defined(Q_OS_WIN64)
+-    exportMacro->name = IndexedString("WIN64");
+-#elif defined(Q_OS_DARWIN)
+-    exportMacro->name = IndexedString("__APPLE__");
+-#elif defined(Q_OS_SOLARIS)
+-    exportMacro->name = IndexedString("__sun");
+-#else
+-    // fall back to linux if nothing matches
+-    exportMacro->name = IndexedString("__linux__");
+-#endif
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
+-
+-#if defined(Q_OS_DARWIN64)
+-    exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__LP64__");
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
+-#endif
+-
+-#if (defined(QT_ARCH_ARM) || defined (QT_ARCH_ARMV6)) && !defined(QT_NO_ARM_EABI)
+-    exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__ARM_EABI__");
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
+-#endif
++    CppTools::setupStandardMacros(*m_topBlock);
+ 
+-    // ansidecl.h will define macros for keywords if we don't define __STDC__
+-    exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__STDC__");
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
+-
+-    exportMacro = new rpp::pp_macro;
+-    exportMacro->name = IndexedString("__SMOKEGEN_RUN__");
+-    exportMacro->definition.append(IndexedString('1'));
+-    exportMacro->function_like = false;
+-    exportMacro->variadics = false;
+-    m_topBlock->setMacro(exportMacro);
++    // Do not add standard include paths
++//    foreach (QString dir, CppTools::setupStandardIncludePaths()) {
++//        m_includeDirs << QDir(dir);
++//    }
+ 
+     foreach (QString define, defines) {
+         exportMacro = new rpp::pp_macro;
+--- /dev/null
++++ b/setuphelpers.cpp
+@@ -0,0 +1,170 @@
++/*
++* This file is part of KDevelop
++*
++* Copyright 2007-2008 David Nolden <david.nolden.kdevelop at art-master.de>
++* Copyright 2007 Kris Wong <kris.p.wong at gmail.com>
++* Copyright 2011 Modestas Vainius <modax at debian.org>
++*
++* This program is free software; you can redistribute it and/or modify
++* it under the terms of the GNU Library General Public License as
++* published by the Free Software Foundation; either version 2 of the
++* License, or (at your option) any later version.
++*
++* This program is distributed in the hope that it will be useful,
++* but WITHOUT ANY WARRANTY; without even the implied warranty of
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++* GNU General Public License for more details.
++*
++* You should have received a copy of the GNU General Public
++* License along with this program; if not, write to the
++* Free Software Foundation, Inc.,
++* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++*/
++#include "setuphelpers.h"
++
++#include <QString>
++#include <QStringList>
++
++//#include <rpp/chartools.h>
++#include <rpp/pp-environment.h>
++#include <rpp/pp-macro.h>
++
++namespace CppTools {
++QStringList gccSetupStandardIncludePaths();
++const QVector<rpp::pp_macro*>& gccStandardMacros();
++
++#ifdef _MSC_VER
++QStringList msvcSetupStandardIncludePaths();
++const QVector<rpp::pp_macro*>& msvcStandardMacros();
++#endif
++
++QStringList setupStandardIncludePaths()
++{
++//TODO: this should happen depending on the actual compiler used for the target and not on the compiler used for kdevelop itself.
++#ifdef _MSC_VER
++    QStringList includePaths = msvcSetupStandardIncludePaths();
++#else
++    QStringList includePaths = gccSetupStandardIncludePaths();
++#endif
++    return includePaths;
++}
++
++void insertMacro(rpp::MacroBlock& macros, const rpp::pp_macro& macro)
++{
++  macros.setMacro(new rpp::pp_macro(macro));
++}
++
++void setupStandardMacros(rpp::MacroBlock& macros)
++{
++    //Add some macros to be compatible with the gnu c++ compiler
++    //Used in several headers like sys/time.h
++    insertMacro( macros, rpp::pp_macro("__restrict") );
++    insertMacro( macros, rpp::pp_macro("__extension__") );
++    //Add macros that allow special treatment when within kdevelop
++    insertMacro( macros, rpp::pp_macro("IN_KDEVELOP_PARSER") );
++    insertMacro( macros, rpp::pp_macro("IN_IDE_PARSER") );
++    {
++      //Used in several headers like sys/time.h
++      rpp::pp_macro m("__const");
++      m.setDefinitionText( "const" );
++      insertMacro( macros, m );
++    }
++    {
++      rpp::pp_macro m("__null");
++      m.setDefinitionText( "0" );
++      insertMacro( macros, m );
++      m.name = IndexedString("NULL");
++      insertMacro( macros, m );
++    }
++
++    {
++      //Used in several gcc headers
++      rpp::pp_macro m("__inline");
++      m.setDefinitionText( "inline" );
++      insertMacro( macros, m );
++      m.name = IndexedString("__always_inline");
++      insertMacro( macros, m );
++    }
++
++    {
++      //It would be better if the parser could deal with it, for example in class declarations. However it cannot.
++      //If we wouldn't need this, macros could be more transparent.
++      rpp::pp_macro m("__attribute__");
++      m.function_like = true;
++      m.formalsList().append(IndexedString("param"));
++      insertMacro( macros, m );
++    }
++    
++    /// The following macros are required for qt only. That's why we set them to become active only when their
++    /// 'real' versions become defined in qobjectdefs.h. A slight problem is that they are 'fixed', so they will block
++    /// any other macros with the same names.
++    {
++      rpp::pp_macro m("Q_SLOTS");
++      m.setDefinitionText( "__qt_slots__" );
++      
++      m.defined = false;
++      m.defineOnOverride = true;
++      m.file = IndexedString("/qobjectdefs.h"); // Only define the macro if it is overriden in this file
++      m.fixed = true;
++      
++      insertMacro( macros, m );
++
++      m.name = IndexedString("Q_PRIVATE_SLOT");
++      m.formalsList().append(IndexedString("d"));
++      m.formalsList().append(IndexedString("sig"));
++      m.function_like = true;
++      m.setDefinitionText( "private slots: sig{ d; }; private:" );
++      insertMacro( macros, m );
++      
++      m.name = IndexedString("slots");
++      m.setDefinitionText("__qt_slots__");
++      m.formalsList().clear();
++      m.function_like = false;
++      insertMacro( macros, m );
++
++      m.name = IndexedString("Q_SIGNALS");
++      m.setDefinitionText( "__qt_signals__" );
++      m.formalsList().clear();
++      insertMacro( macros, m );
++
++      m.name = IndexedString("signals");
++      m.setDefinitionText("__qt_signals__");
++      m.formalsList().clear();
++      insertMacro( macros, m );
++
++      m.name = IndexedString("SIGNAL");
++      m.setDefinitionText("__qt_signal__");
++      m.formalsList().clear();
++      insertMacro( macros, m );
++      
++      m.name = IndexedString("SLOT");
++      m.setDefinitionText("__qt_slot__");
++      m.formalsList().clear();
++      insertMacro( macros, m );
++
++      m.name = IndexedString("Q_PROPERTY");
++      m.setDefinitionText("__qt_property__");
++      m.formalsList().clear();
++      insertMacro( macros, m );
++    }
++    
++    {
++      // We don't provide a real implementation of offsetof, but at least provide a stub that allows correct use-building for the member.
++      rpp::pp_macro m("__builtin_offsetof");
++      m.function_like = true;
++      m.formalsList().append(IndexedString("TYPE"));
++      m.formalsList().append(IndexedString("MEMBER"));
++      m.setDefinitionText("(size_t)((void)TYPE::MEMBER)");
++      insertMacro( macros, m );
++    }
++
++#ifdef _MSC_VER    
++    foreach(const rpp::pp_macro* macro, msvcStandardMacros())
++#else
++    foreach(const rpp::pp_macro* macro, gccStandardMacros())
++#endif
++      insertMacro(macros, *macro);
++}
++
++}
++
+--- /dev/null
++++ b/setuphelpers.h
+@@ -0,0 +1,47 @@
++/*
++* This file is part of KDevelop
++*
++* Copyright 2007-2008 David Nolden <david.nolden.kdevelop at art-master.de>
++* Copyright 2007 Kris Wong <kris.p.wong at gmail.com>
++*
++* This program is free software; you can redistribute it and/or modify
++* it under the terms of the GNU Library General Public License as
++* published by the Free Software Foundation; either version 2 of the
++* License, or (at your option) any later version.
++*
++* This program is distributed in the hope that it will be useful,
++* but WITHOUT ANY WARRANTY; without even the implied warranty of
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++* GNU General Public License for more details.
++*
++* You should have received a copy of the GNU General Public
++* License along with this program; if not, write to the
++* Free Software Foundation, Inc.,
++* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++*/
++#ifndef CPPTOOLSSETUPHELPERS_H
++#define CPPTOOLSSETUPHELPERS_H
++
++class QStringList;
++namespace rpp {
++    class MacroBlock;
++}
++
++namespace CppTools {
++
++    /**
++    * This function attempts to run a gcc command to retrieve the standard
++    * c++ include paths for this machine.
++    */
++    QStringList setupStandardIncludePaths();
++
++    /**
++    * This function attempts to run a gcc command to retrieve the standard
++    * c++ macro definitions.
++    */
++    void setupStandardMacros(rpp::MacroBlock& macros);
++
++}
++
++#endif
++
+--- /dev/null
++++ b/setuphelpers_gcc.cpp
+@@ -0,0 +1,161 @@
++/*
++* This file is part of KDevelop
++*
++* Copyright 2007-2008 David Nolden <david.nolden.kdevelop at art-master.de>
++* Copyright 2007 Kris Wong <kris.p.wong at gmail.com>
++* Copyright 2011 Modestas Vainius <modax at debian.org>
++*
++* This program is free software; you can redistribute it and/or modify
++* it under the terms of the GNU Library General Public License as
++* published by the Free Software Foundation; either version 2 of the
++* License, or (at your option) any later version.
++*
++* This program is distributed in the hope that it will be useful,
++* but WITHOUT ANY WARRANTY; without even the implied warranty of
++* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++* GNU General Public License for more details.
++*
++* You should have received a copy of the GNU General Public
++* License along with this program; if not, write to the
++* Free Software Foundation, Inc.,
++* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
++*/
++#include "setuphelpers.h"
++
++#include <QString>
++#include <QStringList>
++#include <QDir>
++#include <QtCore/QProcess>
++#include <QtCore/QDebug>
++
++#include <rpp/pp-macro.h>
++
++#ifdef _WIN32
++#define NULL_DEVICE "NUL"
++#else
++#define NULL_DEVICE "/dev/null"
++#endif
++
++namespace CppTools {
++
++QStringList gccSetupStandardIncludePaths()
++{
++    QStringList includePaths;
++    
++    QProcess proc;
++    proc.setProcessChannelMode(QProcess::MergedChannels);
++    proc.setTextModeEnabled(true);
++
++    // The following command will spit out a bnuch of information we don't care
++    // about before spitting out the include paths.  The parts we care about
++    // look like this:
++    // #include "..." search starts here:
++    // #include <...> search starts here:
++    //  /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2
++    //  /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/i486-linux-gnu
++    //  /usr/lib/gcc/i486-linux-gnu/4.1.2/../../../../include/c++/4.1.2/backward
++    //  /usr/local/include
++    //  /usr/lib/gcc/i486-linux-gnu/4.1.2/include
++    //  /usr/include
++    // End of search list.
++    proc.start("gcc", QStringList() <<"-xc++" <<"-E" <<"-v" <<NULL_DEVICE);
++
++    // We'll use the following constants to know what we're currently parsing.
++    const short parsingInitial = 0;
++    const short parsedFirstSearch = 1;
++    const short parsingIncludes = 2;
++    const short parsingFinished = 3;
++    short parsingMode = parsingInitial;
++
++    if (proc.waitForStarted() && proc.waitForFinished(5000) &&
++        proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0)
++    {
++        QString line;
++        while (proc.canReadLine() && parsingMode != parsingFinished) {
++            QByteArray buff = proc.readLine();
++            if (!buff.isEmpty()) {
++                line = buff;
++                switch (parsingMode) {
++                case parsingInitial:
++                    if (line.indexOf("#include \"...\"") != -1) {
++                        parsingMode = parsedFirstSearch;
++                    }
++                    break;
++                case parsedFirstSearch:
++                    if (line.indexOf("#include <...>") != -1) {
++                        parsingMode = parsingIncludes;
++                        break;
++                    }
++                case parsingIncludes:
++                    //if (!line.indexOf(QDir::separator()) == -1 && line != "." ) {
++                    //Detect the include-paths by the first space that is prepended. Reason: The list may contain relative paths like "."
++                    if (!line.startsWith(" ") ) {
++                        // We've reached the end of the list.
++                        parsingMode = parsingFinished;
++                    } else {
++                        line = line.trimmed();
++                        // This is an include path, add it to the list.
++                        includePaths << QDir::cleanPath(line);
++                    }
++                    break;
++                }
++            }
++        }
++    } else {
++        qDebug() <<"Unable to read standard c++ macro definitions from gcc:" <<QString(proc.readAll()) ;
++    }
++    
++    return includePaths;
++}
++
++QVector<rpp::pp_macro*> computeGccStandardMacros()
++{
++    QVector<rpp::pp_macro*> ret;
++    //Get standard macros from gcc
++    QProcess proc;
++    proc.setProcessChannelMode(QProcess::MergedChannels);
++    proc.setTextModeEnabled(true);
++
++    // The output of the following gcc commands is several line in the format:
++    // "#define MACRO [definition]", where definition may or may not be present.
++    // Parsing each line sequentially, we can easily build the macro set.
++    proc.start("gcc", QStringList() <<"-xc++" <<"-E" <<"-dM" <<NULL_DEVICE);
++
++    if (proc.waitForStarted() && proc.waitForFinished(5000) &&
++        proc.exitStatus() == QProcess::NormalExit && proc.exitCode() == 0)
++    {
++        QString line;
++        while (proc.canReadLine()) {
++            QByteArray buff = proc.readLine();
++            if (!buff.isEmpty()) {
++                line = buff;
++                if (line.startsWith("#define ")) {
++                    line = line.right(line.length() - 8).trimmed();
++                    int pos = line.indexOf(' ');
++                    
++                    ret.append(new rpp::pp_macro);
++                    
++                    rpp::pp_macro& macro(*ret.back());
++                    if (pos != -1) {
++                        macro.name = IndexedString( line.left(pos) );
++                        macro.setDefinitionText( line.right(line.length() - pos - 1).toUtf8() );
++                    } else {
++                        macro.name = IndexedString( line );
++                    }
++                }
++            }
++        }
++    } else {
++        qDebug() <<"Unable to read standard c++ macro definitions from gcc:" <<QString(proc.readAll()) ;
++    }
++    return ret;
++}
++
++const QVector<rpp::pp_macro*>& gccStandardMacros()
++{
++  static QVector<rpp::pp_macro*> macros = computeGccStandardMacros();
++  return macros;
++}
++
++}
++
+--- a/generatorenvironment.cpp
++++ b/generatorenvironment.cpp
+@@ -38,15 +38,26 @@ GeneratorEnvironment::~GeneratorEnvironm
+ 
+ void GeneratorEnvironment::setMacro(rpp::pp_macro* macro)
+ {
+-    QString macroName = macro->name.str();
+-    if (   macroName == "signals" || macroName == "slots" || macroName == "Q_SIGNALS" || macroName == "Q_SLOTS"
+-        || ParserOptions::dropMacros.contains(macroName)) {
++    rpp::pp_macro* hadMacro = retrieveStoredMacro(macro->name);
++
++    if(hadMacro && hadMacro->fixed) {
++      if(hadMacro->defineOnOverride && (hadMacro->file.isEmpty() ||
++          (macro->file.length() >= hadMacro->file.length() &&
++           memcmp(macro->file.byteArray().data() + (macro->file.length() - hadMacro->file.length()), 
++                         hadMacro->file.byteArray().data(),
++                         hadMacro->file.length()) == 0)))
++      {
++        // We have to define the macro now, as it is being overridden
++        rpp::pp_macro* definedMacro = new rpp::pp_macro(*hadMacro);
++        definedMacro->defined = true;
+         delete macro;
+-        return;
+-    } else if (ParserOptions::qtMode && macroName == "Q_PROPERTY") {
++        macro = definedMacro;
++      }else{
++        // A fixed macro exists, simply ignore the added macro
+         delete macro;
+-        rpp::Environment::setMacro(q_property);
+         return;
++      }
+     }
++
+     rpp::Environment::setMacro(macro);
+ }
+--- a/parser/rpp/pp-macro.cpp
++++ b/parser/rpp/pp-macro.cpp
+@@ -50,6 +50,7 @@ bool pp_macro::operator==(const pp_macro
+          function_like == rhs.function_like &&
+          variadics == rhs.variadics &&
+          fixed == rhs.fixed &&
++         defineOnOverride == rhs.defineOnOverride &&
+          definition == rhs.definition &&
+          formals == rhs.formals;
+ //          listsEqual(rhs);
+@@ -66,6 +67,7 @@ pp_macro::pp_macro(const IndexedString&
+   , function_like(false)
+   , variadics(false)
+   , fixed(false)
++  , defineOnOverride(false)
+   , m_valueHashValid(false)
+   , m_valueHash(0)
+ {
+@@ -81,6 +83,7 @@ pp_macro::pp_macro(const pp_macro& rhs,
+    function_like(rhs.function_like),
+    variadics(rhs.variadics),
+    fixed(rhs.fixed),
++   defineOnOverride(rhs.defineOnOverride),
+    m_valueHashValid(true),
+    m_valueHash(rhs.valueHash()),
+    definition(rhs.definition),
+@@ -97,6 +100,7 @@ pp_macro::pp_macro(const char* nm) : nam
+   , function_like(false)
+   , variadics(false)
+   , fixed(false)
++  , defineOnOverride(false)
+   , m_valueHashValid(false)
+   , m_valueHash(0)
+ {
+@@ -139,7 +143,7 @@ void pp_macro::computeHash() const {
+ 
+     m_valueHash = 27 * ( 137 + (defined ? 1 : 0 ) );
+ 
+-    m_valueHash += 1741 * file.hash() + 238 * sourceLine + (hidden ? 19 : 0) + (function_like ? 811241 : 0) + (variadics ? 129119 : 0) + (fixed ? 1807 : 0);
++    m_valueHash += 1741 * file.hash() + 238 * sourceLine + (hidden ? 19 : 0) + (function_like ? 811241 : 0) + (variadics ? 129119 : 0) + (fixed ? 1807 : 0) + (defineOnOverride ? 31621 : 0);
+   
+     foreach(const IndexedString& definitionComponent, definition)
+       m_valueHash = definitionComponent.hash() + 17 * m_valueHash;
+--- a/parser/rpp/pp-macro.h
++++ b/parser/rpp/pp-macro.h
+@@ -66,6 +66,10 @@ struct CPPPARSER_EXPORT pp_macro
+   bool function_like: 1; // hasArguments
+   bool variadics: 1;
+   bool fixed : 1; //If this is set, the macro can not be overridden or undefined.
++  //If defineOnOverride is set, the macro is changed to "defined = true", if it is overridden.
++  //If the macro also has a valid "file" entry, the macro will only be defined if the file-name of the overriding
++  //macro ends with the string given in 'file'.
++  bool defineOnOverride : 1;
+   mutable bool m_valueHashValid : 1;
+   
+   //The valueHash is not necessarily valid
+@@ -152,6 +156,10 @@ struct CPPPARSER_EXPORT pp_macro
+   void setDefinitionText(const char* definition) {
+     setDefinitionText(QByteArray(definition));
+   }
++
++  inline QVector<IndexedString>& formalsList() {
++    return formals;
++  }
+   
+ //   START_APPENDED_LISTS(pp_macro)
+ //   APPENDED_LIST_FIRST(pp_macro, IndexedString, definition)
diff --git a/debian/patches/version_cppparser_library.diff b/debian/patches/version_cppparser_library.diff
new file mode 100644
index 0000000..2a243c2
--- /dev/null
+++ b/debian/patches/version_cppparser_library.diff
@@ -0,0 +1,10 @@
+--- a/parser/CMakeLists.txt
++++ b/parser/CMakeLists.txt
+@@ -36,6 +36,7 @@ set(cppparser_LIB_SRCS
+ 
+ add_definitions(-D__CPPPARSER_BUILDING)
+ add_library(cppparser SHARED ${cppparser_LIB_SRCS})
++set_target_properties(cppparser PROPERTIES VERSION 0a.0.0 SOVERSION 0a)
+ target_link_libraries(cppparser ${QT_QTCORE_LIBRARY})
+ 
+ install(TARGETS cppparser LIBRARY DESTINATION ${LIB_INSTALL_DIR})

-- 
smokegen packaging



More information about the pkg-kde-commits mailing list