diff --git a/src/common/version.c b/src/common/version.c index 2f19f0466..2ebb58b0a 100644 --- a/src/common/version.c +++ b/src/common/version.c @@ -49,7 +49,46 @@ #define VER_MAJOR 2U #define VER_MINOR 19U - +/* + * Note: until 2.19 the __CC65__ macro was defined as (VER_MAJOR * 0x100) + VER_MINOR * 0x10 + * which resulted in broken values starting at version 2.16 of the compiler: + * + * version __CC65__ identifies as + * + * 2.0 0x0200 2.0 + * 2.1 0x0210 2.16 + * 2.2 0x0220 2.32 + * 2.3 0x0230 2.48 + * 2.4 0x0240 2.64 + * 2.5 0x0250 2.80 + * 2.6 0x0260 2.96 + * 2.7 0x0270 2.112 + * 2.8 0x0280 2.128 + * 2.9 0x0290 2.144 + * 2.10 0x02a0 2.160 + * 2.11 0x02b0 2.176 + * 2.12 0x02c0 2.192 + * 2.13 0x02d0 2.208 + * 2.14 0x02e0 2.224 + * 2.15 0x02f0 2.240 + * 2.16 0x0300 3.0 + * 2.17 0x0310 3.16 + * 2.18 0x0320 3.32 + * 2.19 0x0330 3.48 + * 2.19-git 0x0213 2.19 + * + * to keep damage low(er), we should do the following: + * + * - bump to 3.1 (skip 3.0) before 2.32 + * - bump to 4.0 before 3.16 + * + * That way at least each value is unique, and checking compiler version(s) can + * still work to some degree, should it really be necessary. + * + * Some preprocessor kludges can be used to still check for greater or lesser + * versions - see the checkversion program in the samples directory. + * + */ /*****************************************************************************/ /* Code */ @@ -74,5 +113,8 @@ const char* GetVersionAsString (void) unsigned GetVersionAsNumber (void) /* Returns the version number as a combined unsigned for use in a #define */ { - return ((VER_MAJOR * 0x100) + (VER_MINOR * 0x10)); +#if VER_MINOR >= 0x100 +#error "VER_MINOR must be smaller than 0x100 - time to bump the major version!" +#endif + return ((VER_MAJOR * 0x100) + VER_MINOR); }