From kde-core-devel Thu Oct 19 20:07:33 2006 From: Ismail Donmez Date: Thu, 19 Oct 2006 20:07:33 +0000 To: kde-core-devel Subject: Fwd: KDE/kdebase/apps/konsole/konsole Message-Id: <200610192307.33499.ismail () pardus ! org ! tr> X-MARC-Message: https://marc.info/?l=kde-core-devel&m=116132565130028 Don't want to start any flamewars about gcc, but last time we said trunk would only support gcc 3.4+ only because other versions especially gcc 3.3 as seen in this case has buggy C++ support. Or is it gcc 3.3+ ? Regards, ismail --------------- İletilen mesaj (başlangıç) Konu: KDE/kdebase/apps/konsole/konsole Gönderen: George Staikos Tarih: Thu, 19 Oct 2006 22:55:29 +0300 Newsgroup: gmane.comp.kde.cvs SVN commit 597273 by staikos: make it compile with gcc 3.3. the inlined switch() is an issue. Also while we're at it, avoid copying data around in operator== and !=, and make them potentially faster. Remove unnecessary null initilizations. Now I can compile and launch konsole with gcc 3.3 and it even kind of works. M +40 -40 TECommon.h M +2 -2 TEScreen.cpp --- trunk/KDE/kdebase/apps/konsole/konsole/TECommon.h #597272:597273 @@ -128,52 +128,52 @@ class cacol { public: - cacol(); - cacol(UINT8 space, int color); + cacol() : t(0), u(0), v(0), w(0) {} + cacol(UINT8 ty, int co) : t(ty), u(0), v(0), w(0) + { + if (CO_DFT == t) { + u = co & 1; + } else if (CO_SYS == t) { + u = co & 7; + v = (co >> 3) & 1; + } else if (CO_256 == t) { + u = co & 255; + } else if (CO_RGB == t) { + u = co >> 16; + v = co >> 8; + w = co; + } +#if 0 + // Doesn't work with gcc 3.3.4 + switch (t) + { + case CO_UND: break; + case CO_DFT: u = co& 1; break; + case CO_SYS: u = co& 7; v = (co>>3)&1; break; + case CO_256: u = co&255; break; + case CO_RGB: u = co>>16; v = co>>8; w = co; break; + default : t = 0; break; + } +#endif + } UINT8 t; // color space indicator UINT8 u; // various bytes representing the data in the respective ... UINT8 v; // ... color space. C++ does not do unions, so we cannot ... UINT8 w; // ... express ourselfs here, properly. void toggleIntensive(); // Hack or helper? QColor color(const ColorEntry* base) const; - friend bool operator == (cacol a, cacol b); - friend bool operator != (cacol a, cacol b); + friend bool operator == (const cacol& a, const cacol& b); + friend bool operator != (const cacol& a, const cacol& b); }; -#if 0 -inline cacol::cacol(UINT8 _t, UINT8 _u, UINT8 _v, UINT8 _w) -: t(_t), u(_u), v(_v), w(_w) -{ -} -#else -inline cacol::cacol(UINT8 ty, int co) -: t(ty), u(0), v(0), w(0) -{ - switch (t) - { - case CO_UND: break; - case CO_DFT: u = co& 1; break; - case CO_SYS: u = co& 7; v = (co>>3)&1; break; - case CO_256: u = co&255; break; - case CO_RGB: u = co>>16; v = co>>8; w = co; break; - default : t = 0; break; - } -} -#endif - -inline cacol::cacol() // undefined, really -: t(CO_UND), u(0), v(0), w(0) -{ -} - -inline bool operator == (cacol a, cacol b) +inline bool operator == (const cacol& a, const cacol& b) { - return a.t == b.t && a.u == b.u && a.v == b.v && a.w == b.w; + return *reinterpret_cast(&a.t) == *reinterpret_cast(&b.t); } -inline bool operator != (cacol a, cacol b) +inline bool operator != (const cacol& a, const cacol& b) { - return a.t != b.t || a.u != b.u || a.v != b.v || a.w != b.w; + return *reinterpret_cast(&a.t) != *reinterpret_cast(&b.t); } inline const QColor color256(UINT8 u, const ColorEntry* base) @@ -235,18 +235,18 @@ bool isTransparent(const ColorEntry* base) const; bool isBold(const ColorEntry* base) const; public: - friend bool operator == (ca a, ca b); - friend bool operator != (ca a, ca b); + friend bool operator == (const ca& a, const ca& b); + friend bool operator != (const ca& a, const ca& b); }; -inline bool operator == (ca a, ca b) +inline bool operator == (const ca& a, const ca& b) { - return a.c == b.c && a.f == b.f && a.b == b.b && a.r == b.r; + return a.c == b.c && a.r == b.r && a.f == b.f && a.b == b.b; } -inline bool operator != (ca a, ca b) +inline bool operator != (const ca& a, const ca& b) { - return a.c != b.c || a.f != b.f || a.b != b.b || a.r != b.r; + return a.c != b.c || a.r != b.r || a.f != b.f || a.b != b.b; } inline bool ca::isTransparent(const ColorEntry* base) const --- trunk/KDE/kdebase/apps/konsole/konsole/TEScreen.cpp #597272:597273 @@ -73,7 +73,7 @@ histCursor(0), hist(new HistoryScrollNone()), cuX(0), cuY(0), - cu_fg(cacol()), cu_bg(cacol()), cu_re(0), + cu_re(0), tmargin(0), bmargin(0), tabstops(0), sel_begin(0), sel_TL(0), sel_BR(0), @@ -81,7 +81,7 @@ columnmode(false), ef_fg(cacol()), ef_bg(cacol()), ef_re(0), sa_cuX(0), sa_cuY(0), - sa_cu_re(0), sa_cu_fg(cacol()), sa_cu_bg(cacol()), + sa_cu_re(0), lastPos(-1) { --------------- İletilen mesaj (bitiş)