r18957 - gnucash/trunk/src - Add new CPP macros which make it cleaner to have conditional compilation based on compiler/system and options selected during config

Phil Longstaff plongstaff at code.gnucash.org
Tue Mar 23 14:34:17 EDT 2010


Author: plongstaff
Date: 2010-03-23 14:34:17 -0400 (Tue, 23 Mar 2010)
New Revision: 18957
Trac: http://svn.gnucash.org/trac/changeset/18957

Added:
   gnucash/trunk/src/platform.h
Log:
Add new CPP macros which make it cleaner to have conditional compilation based on compiler/system and options selected during config

Examples:

#if COMPILER(MSVC)
#if COMPILER(GCC)

#if ENABLE(NLS)
#if HAVE(PUTENV)

This platform.h file includes config.h, so that doesn't need to be included any more.

PLATFORM(X) is based on the definition of GNC_PLATFORM_X
COMPILER(X) is based on the definition of GNC_COMPILER_X.  At this point, only COMPILER(GCC), COMPILER(MSVC), COMPILER(MSVC7) and COMPILER(MINGW) are determined.
HAVE(X) is based on HAVE_X from config.h
ENABLE(X) is based on ENABLE_X from config.h
USE(X) is based on GNC_USE_X from config.h

Having these determinations at a central point makes it easier to add new platforms and easier to conditionally compile based on them.





More information about the gnucash-patches mailing list