Hacks to make your skin crawl
Some of the stuff we have to do to get KDE4 compiling on Solaris is just downright unpleasant. Today I added (in our local repository only) a hack that is just quintessentially icky, but which eases a lot of maintainence burden.
The story goes like this: we use RogueWave stdcxx 4.1.3 as a standard C++ library. This is a pretty strictly conforming STL and the rest of it. But it’s also a little peculiar, and hard to parse. Qt’s moc seems to have particular trouble with it. I think it is a weakness of the parser in handling keywords. Consider the following tiny bit of source code:
#define _USING(a)
_USING(int nil)
The moc will process that, complain there’s no relevant classes, and be done. But if you replace ‘int’ with ‘namespace’ – the resulting source after pre-processing is exactly the same – then you get a parse error. But if you insert a ; (so you have ‘namespace nil;’ as a macro argument) then it works again. In RW stdcxx, _USING
is defined to produce ‘using’ if the compiler supports the using keyword, so that’s why this kind of weird construction occurs.
One way of working around it is to let moc behave as if we use the non-RW C++ libraries. So instead of handing -I/path/to/rwstdcxx
to moc we should avoid it. The creepy hack I added just now to automoc is to remove exactly that path before invoking moc. Eww. Ewwwwww. If that’s not horribly fragile, I don’t know what is. It does get us through a whole lot more of the KDE compilation process without having to second-guess and work around automoc in lots of places.
There’s an alternative, of course, and that’s to add that extra ;
to keep moc happy. There’s a long compile going on to check that. (I wouldn’t expect the Trolls to go out of their way to support this particular bit of ugliness.)
The Wayback Machine ⏲ does not archive everything. Broken links are marked with a 💔.