[Qt-creator] portability fixes

Oswald Buddenhagen oswald.buddenhagen at trolltech.com
Wed Jun 3 21:12:45 CEST 2009


moin,

i just checked in a bunch of platform conditional fixes and unifications
(*). as i prefer not to repeat this "fun" before every release, please
try to obey these rules:

- use Q_OS_UNIX instead of Q_OS_LINUX unless you *really* mean linux.
  for consistency, use Q_OS_MAC and Q_OS_WIN instead of Q_OS_DARWIN,
  Q_OS_MACX and Q_OS_WIN32.

- mostly academic in our environment: for ui-related conditionals (and
  *only* those), use Q_WS_MAC, Q_WS_WIN and Q_WS_X11 instead of the
  Q_OS_* defines.

- use "cascades" of the type
    #if defined(Q_OS_WIN)
    #elif defined(Q_OS_MAC)
    #else // UNIX
    #endif
  instead of "free-standing" consecutive #ifdefs. it's simpler to verify
  that all cases are covered that way. for uniformity, please try to
  use the order given above.

- if you add some platform-specific code in an #ifdef, please make sure
  that you put the pre-existing code into an #else branch if applicable.
  i found several cases were code would be just unreachable on certain
  platforms. this makes it both harder to follow the logic and makes
  some compiler configurations spit out warnings.

- install targets should be conditional on unix:!macx

have fun

(*) i hope it still compiles on non-linux :-D




More information about the Qt-creator-old mailing list