[Development] Proposition for a new Q_OS_ define

Sorvig Morten Morten.Sorvig at digia.com
Mon Mar 25 10:11:53 CET 2013


On Mar 23, 2013, at 1:51 AM, Jake Thomas Petroules <jake.petroules at petroules.com> wrote:

> I'd like to suggest that we add a new Q_OS_ define.
> 
> Currently, for Apple platforms, we have:
> 
> Q_OS_DARWIN
> Q_OS_DARWIN32
> Q_OS_DARWIN64
> Q_OS_IOS
> Q_OS_MAC
> Q_OS_MAC32
> Q_OS_MAC64
> Q_OS_MACX
> 
> The first three are very straightforward. Q_OS_DARWIN is defined for both Apple platforms, OS X and iOS, with specific defines for 32 and 64 bit. iOS -- also straightforward; means iOS.
> 
> Then we get confusing. You'd think Q_OS_MAC is defined for OS X only, but it's just a synonym for Darwin, which makes it mostly useless. Further confusing is Q_OS_MACX which even more strongly implies that  it refers to OS X, but again it's simply a synonym for Darwin.
> 
> This results in a ton of #if defined(Q_OS_MAC) && !defined(Q_OS_IOS), which is very counterproductive. I propose that we add a Q_OS_OSX define (and Q_OS_OSX32 / Q_OS_OSX64) which is only defined for OS X. This would be quite helpful, I think.
> 
> Any objections? If not, dev or stable?

My initial thoughts are that the current situation is manageable and that "very counterproductive" is an overstatement. 

We recently started differentiating between "mac" and "macx" on the qmake level (d28073d9). A quick grep shows that "Q_OS_MACX" is currently used in two places in Qt (qsharedpointer.cpp and tst_qmlvisual.cpp). Re-purposing it to mean "OS X" only should be doable.

Morten




More information about the Development mailing list