From ac36bfe2794741188da1d6d4b471f96fd15d47ee Mon Sep 17 00:00:00 2001 From: zecke Date: Fri, 15 Oct 2004 19:23:42 +0000 Subject: -Add a QPEGLOBAL that adds define for 'weak', 'used' and unused symbols Make use of the newly added qpeglobal.h to kill custom versions of similiar macros --- diff --git a/library/calendar.cpp b/library/calendar.cpp index 70e764c..d281a14 100644 --- a/library/calendar.cpp +++ b/library/calendar.cpp @@ -18,10 +18,12 @@ ** **********************************************************************/ #include "calendar.h" +#include "qpeglobal.h" #include #include + /*! \class Calendar calendar.html \brief The Calendar class provides programmers with an easy to calculate @@ -30,14 +32,7 @@ \ingroup qtopiaemb */ -#ifdef Q_OS_MACX - #define ATTRIBUTE_UNUSED -#else - #define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - - -static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() ATTRIBUTE_UNUSED; +static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() QPE_SYMBOL_UNUSED; static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() { (void)QObject::tr("Jan"); (void)QObject::tr("Feb"); diff --git a/library/library.pro b/library/library.pro index ffd20fd..cdc1dab 100644 --- a/library/library.pro +++ b/library/library.pro @@ -59,7 +59,8 @@ HEADERS = calendar.h \ windowdecorationinterface.h \ textcodecinterface.h \ imagecodecinterface.h \ - qt_override_p.h + qt_override_p.h \ + qpeglobal.h SOURCES = calendar.cpp \ global.cpp \ diff --git a/library/qpeapplication.cpp b/library/qpeapplication.cpp index df313ce..3efba20 100644 --- a/library/qpeapplication.cpp +++ b/library/qpeapplication.cpp @@ -88,6 +88,7 @@ #include "qpemenubar.h" #include "textcodecinterface.h" #include "imagecodecinterface.h" +#include #include #include @@ -1294,12 +1295,7 @@ void QPEApplication::reset() { #if (QT_VERSION < 238) && defined Q_OS_MACX bool qt_left_hand_scrollbars = false; #else -#ifdef Q_OS_MACX -#define WEAK_SYMBOL __attribute__((weak_import)) -#else -#define WEAK_SYMBOL __attribute__((weak)) -#endif -extern bool qt_left_hand_scrollbars WEAK_SYMBOL; +extern bool qt_left_hand_scrollbars QPE_WEAK_SYMBOL; #endif /*! diff --git a/library/qpeglobal.h b/library/qpeglobal.h new file mode 100644 index 0000000..96ce3a6 --- a/dev/null +++ b/library/qpeglobal.h @@ -0,0 +1,55 @@ +/* +               =. This file is part of the OPIE Project +             .=l. Copyright (c) 2002,2003,2004 Holger Hans Peter Freyther +           .>+-= + _;:,     .>    :=|. This library is free software; you can +.> <`_,   >  .   <= redistribute it and/or modify it under +:`=1 )Y*s>-.--   : the terms of the GNU Library General Public +.="- .-=="i,     .._ License as published by the Free Software + - .   .-<_>     .<> Foundation; either version 2 of the License, +     ._= =}       : or (at your option) any later version. +    .%`+i>       _;_. +    .i_,=:_.      -`: PARTICULAR PURPOSE. See the GNU +..}^=.=       =       ; Library General Public License for more +++=   -.     .`     .: details. + :     =  ...= . :.=- + -.   .:....=;==+<; You should have received a copy of the GNU +  -_. . .   )=.  = Library General Public License along with +    --        :-=` this library; see the file COPYING.LIB. + If not, write to the Free Software Foundation, + Inc., 59 Temple Place - Suite 330, + Boston, MA 02111-1307, USA. + +*/ + +#ifndef QPE_GLOBAL_H +#define QPE_GLOBAL_H + +/** + * Defines for used compiler attributes + * + */ +#if defined(Q_OS_MACX) +#define QPE_WEAK_SYMBOL __attribute__((weak_import)) +#define QPE_SYMBOL_USED +#define QPE_SYMBOL_UNUSED + +#elif defined(_OS_UNIX_) +#define QPE_WEAK_SYMBOL __attribute__((weak)) +#define QPE_SYMBOL_USED __attribute__((used)) +#define QPE_SYMBOL_UNUSED __attribute__((unused)) + + +#else // defined(Q_OS_WIN32) +#define QPE_WEAK_SYMBOL +#define QPE_SYMBOL_USED +#define QPE_SYMBOL_UNUSED +#endif + + + +#endif diff --git a/library/qpemessagebox.cpp b/library/qpemessagebox.cpp index c38828a..1df108a 100644 --- a/library/qpemessagebox.cpp +++ b/library/qpemessagebox.cpp @@ -19,17 +19,12 @@ **********************************************************************/ #include "qpemessagebox.h" +#include "qpeglobal.h" #include #include -#ifdef Q_OS_MACX - #define ATTRIBUTE_UNUSED -#else - #define ATTRIBUTE_UNUSED __attribute__((unused)) -#endif - -static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() ATTRIBUTE_UNUSED; +static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() QPE_SYMBOL_UNUSED; static void never_called_tr_function_um_libqpe_ts_etwas_unter_zu_jubeln() { (void)QMessageBox::tr("Yes"); (void)QMessageBox::tr("No"); diff --git a/library/qt_override.cpp b/library/qt_override.cpp index 56f82d7..a0d753b 100644 --- a/library/qt_override.cpp +++ b/library/qt_override.cpp @@ -8,6 +8,7 @@ #include #include // for toolchains with old libc headers +#include #include "qt_override_p.h" #if QT_VERSION > 233 @@ -85,8 +86,7 @@ int Opie::force_appearance = 0; extern "C" { -extern void __gmon_start__ ( ) __attribute__(( weak )); - +extern void __gmon_start__ ( ) QPE_WEAK_SYMBOL; extern void __gmon_start__ ( ) { } @@ -102,8 +102,6 @@ extern void __gmon_start__ ( ) void QPEApplication::polish ( QWidget *w ) { #ifndef OPIE_NO_OVERRIDE_QT -// qDebug ( "QPEApplication::polish()" ); - for ( const color_fix_t *ptr = apps_that_need_special_colors; ptr-> m_app; ptr++ ) { if (( ::strcmp ( Opie::binaryName ( ), ptr-> m_app ) == 0 ) && ( ptr-> m_class ? w-> inherits ( ptr-> m_class ) : true ) && @@ -125,8 +123,6 @@ void QPEApplication::polish ( QWidget *w ) QValueList QFontDatabase::pointSizes ( QString const &family, QString const &style, QString const &charset ) { -// qDebug ( "QFontDatabase::pointSizes()" ); - QValueList sl = pointSizes_NonWeak ( family, style, charset ); for ( const char * const *ptr = apps_that_need_pointsizes_times_10; *ptr; ptr++ ) { @@ -144,8 +140,6 @@ QValueList QFontDatabase::pointSizes ( QString const &family, QString cons void QApplication::setStyle ( QStyle *style ) { -// qDebug ( "QApplication::setStyle()" ); - if ( Opie::force_appearance & Opie::Force_Style ) delete style; else @@ -154,16 +148,12 @@ void QApplication::setStyle ( QStyle *style ) void QApplication::setPalette ( const QPalette &pal, bool informWidgets, const char *className ) { -// qDebug ( "QApplication::setPalette()" ); - if (!( Opie::force_appearance & Opie::Force_Style )) QApplication::setPalette_NonWeak ( pal, informWidgets, className ); } void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *className ) { -// qDebug ( "QApplication::setFont()" ); - if (!( Opie::force_appearance & Opie::Force_Font )) QApplication::setFont_NonWeak ( fnt, informWidgets, className ); } @@ -171,8 +161,6 @@ void QApplication::setFont ( const QFont &fnt, bool informWidgets, const char *c void QApplication::qwsSetDecoration ( QWSDecoration *deco ) { -// qDebug ( "QApplication::qwsSetDecoration()" ); - if ( Opie::force_appearance & Opie::Force_Decoration ) delete deco; else diff --git a/library/stable.h b/library/stable.h index 10f13a6..ea4526c 100644 --- a/library/stable.h +++ b/library/stable.h @@ -72,6 +72,6 @@ #undef QTOPIA_INTERNAL_TZSELECT_INC_LOCAL #include - +#include #endif -- cgit v0.9.0.2