Detect Borland compiler version with its id

Decode hex digits from __BORLANDC__ to compute the version number
components.  Note that the constant encodes decimal digits as hex digits
(never larger than 9).  We represent them as decimal after extraction.
See documentation at

  http://predef.sourceforge.net/precomp.html
  http://docwiki.embarcadero.com/RADStudio/en/Predefined_Macros
This commit is contained in:
Brad King 2011-12-06 12:06:06 -05:00
parent 2cc205a0fb
commit 4080d5510e
2 changed files with 4 additions and 0 deletions

View File

@ -20,6 +20,8 @@
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
# define COMPILER_ID "Borland" # define COMPILER_ID "Borland"
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
# define COMPILER_ID "Watcom" # define COMPILER_ID "Watcom"

View File

@ -22,6 +22,8 @@
#elif defined(__BORLANDC__) #elif defined(__BORLANDC__)
# define COMPILER_ID "Borland" # define COMPILER_ID "Borland"
# define COMPILER_VERSION_MAJOR HEX(__BORLANDC__>>8)
# define COMPILER_VERSION_MINOR HEX(__BORLANDC__ & 0xFF)
#elif defined(__WATCOMC__) #elif defined(__WATCOMC__)
# define COMPILER_ID "Watcom" # define COMPILER_ID "Watcom"