Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 352181 - some refactoring functions remove macros and are confused by macros
Summary: some refactoring functions remove macros and are confused by macros
Status: RESOLVED FIXED
Alias: None
Product: CDT
Classification: Tools
Component: cdt-refactoring (show other bugs)
Version: 8.0   Edit
Hardware: PC Linux
: P3 normal (vote)
Target Milestone: 8.1.0   Edit
Assignee: Sergey Prigogin CLA
QA Contact: Sergey Prigogin CLA
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-07-15 02:56 EDT by Stefan Peters CLA
Modified: 2012-02-23 11:33 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Stefan Peters CLA 2011-07-15 02:56:22 EDT
Build Identifier:  20110615-0604

when developing with Qt is necessary to use the moc ( http://doc.qt.nokia.com/latest/moc.html ) which uses some keywords to identify special sections and these keywords are removed. The keywords are just empty macros.

except from qobjectdef.h:

#   define slots
#   define signals protected

It looks like the macros are expanded on using the function (but for example the Q_OBJECT macro is untouched). Also the formatting is changed (this seems not to be happen if no macros are used)

This is not a Qt specific problem. I attached two examples. the second one does not produce valid code!

Reproducible: Always

Steps to Reproduce:
example 1 (Qt):

original class:

class GotoLineWidget : public QWidget {

    Q_OBJECT


public:

    GotoLineWidget(QWidget *parent = 0);
    ~GotoLineWidget();

    void myToogleTest() {
        qDebug() << "I am here";
    }

private slots:

    void on_close_clicked();
    void on_line_edit_textChanged(QString input_text);
    void on_line_edit_editingFinished();


signals:

    void gotoLine(int line_number);


private:

    Ui::GotoLineWidgetClass ui;
};

and after using "toogle function" on "myToogleTest":

class GotoLineWidget : public QWidget {

    Q_OBJECT


public:

    GotoLineWidget(QWidget *parent = 0);
    ~GotoLineWidget();

    void myToogleTest();
private:
    void on_close_clicked();
    void on_line_edit_textChanged(QString input_text);
    void on_line_edit_editingFinished();
protected:

    void gotoLine(int line_number);


private:

    Ui::GotoLineWidgetClass ui;
};

inline void GotoLineWidget::myToogleTest()
{
    qDebug() << "I am here";
}


example 2:

#ifdef __GNUC__
// gcc emulation mode
#define FINLINE            __attribute__((always_inline))
#define NOINLINE            __attribute__((noinline))
#else
// msvc emulation mode
#define FINLINE               __forceinline
#define NOINLINE            __declspec(noinline)
#endif

class System {


public:

    System();
    virtual ~System();

    static bool isWindows();
    static bool startHelpSystem();
    NOINLINE static QString getVersion();
    NOINLINE static QString getRelease();
};

and in the cpp:

QString System::getRelease() {
    return QString(_RTTUI_RELEASE_);
}

becomes after "toogle function":

class System {


public:

    System();
    virtual ~System();

    static bool isWindows();
    static bool startHelpSystem();
    static QString getVersion()
    {

    }static QString getRelease();

};
Comment 1 Sergey Prigogin CLA 2011-12-14 15:38:53 EST
Fixed together with bug 363244.