1 ///////////////////////////////////////////////////////////////////////////////
2 // Copyright (c) 2000-2015 Ericsson Telecom AB
3 // All rights reserved. This program and the accompanying materials
4 // are made available under the terms of the Eclipse Public License v1.0
5 // which accompanies this distribution, and is available at
6 // http://www.eclipse.org/legal/epl-v10.html
7 ///////////////////////////////////////////////////////////////////////////////
14 #define TTCN3_PATCHLEVEL 0
15 //#define TTCN3_BUILDNUMBER 0
17 /* The aggregated version number must be set manually since some stupid
18 * 'makedepend' programs cannot calculate arithmetic expressions.
19 * In official releases:
20 * TTCN3_VERSION = TTCN3_MAJOR * 10000 + TTCN3_MINOR * 100 + TTCN3_PATCHLEVEL
21 * In pre-release builds:
22 * TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
23 * TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
25 #define TTCN3_VERSION 50400
27 /* A monotonically increasing version number.
28 * An official release is deemed to have the highest possible build number (99)
30 #ifdef TTCN3_BUILDNUMBER
31 #define TTCN3_VERSION_MONOTONE TTCN3_VERSION
33 #define TTCN3_VERSION_MONOTONE (TTCN3_VERSION * 100 + 99)
38 #define PLATFORM_STRING "SOLARIS"
39 #elif defined (SOLARIS8)
40 #define PLATFORM_STRING "SOLARIS8"
42 #define PLATFORM_STRING "LINUX"
44 /* MINGW is defined only if CYGWIN is defined */
46 #define PLATFORM_STRING "MINGW"
48 #define PLATFORM_STRING "WIN32"
50 #elif defined (FREEBSD)
51 #define PLATFORM_STRING "FREEBSD"
52 #elif defined (INTERIX)
53 #define PLATFORM_STRING "INTERIX"
58 #ifndef PLATFORM_STRING
59 /* Just to suppress error later */
60 #define PLATFORM_STRING "UNKNOWN"
61 #error "No supported platform has been defined in the Makefile. The supported ones: SOLARIS, SOLARIS8, LINUX, WIN32"
64 #define STRINGIFY(x) #x
65 #define STR(x) STRINGIFY(x)
69 #ifdef __GNUC_PATCHLEVEL__
70 #define GCC_PATCHLEVEL_STRING "." STR(__GNUC_PATCHLEVEL__)
72 /* __GNUC_PATCHLEVEL__ appeared in gcc 3.0 */
73 #define GCC_PATCHLEVEL_STRING
77 #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100)
79 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
81 /* Ignore __GNUC_PATCHLEVEL__ */
82 #define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING
85 static const char titan_
[] __attribute__ ((section (".titan"))) = \
86 "TITAN: " STR(TTCN3_VERSION
) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING
;
93 /* Prevents the version string from being optimized away */
94 static const reffer
ref_ver(titan_
);
97 #else /* not a GNU compiler */
100 #define __attribute__(arg)
103 #if defined(__SUNPRO_C)
105 #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_C)
107 #elif defined(__SUNPRO_CC)
109 #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_CC)
111 #pragma ident "TITAN: " STR(TTCN3_VERSION) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING;
114 /* Luft! unknown compiler */
115 #endif /* not SunPro */
118 /* __SUNPRO_CC is an all-in-one value */
121 #define FN(f,x) requires_ ## f ## _ ## x
122 #define FIELD_NAME(f,x) FN(f,x)
124 #ifdef TITAN_RUNTIME_2
125 #define TITAN_RUNTIME_NR 2
127 #define TITAN_RUNTIME_NR 1
130 struct runtime_version
{
131 int FIELD_NAME(major_version
, TTCN3_MAJOR
);
132 int FIELD_NAME(minor_version
, TTCN3_MINOR
);
133 int FIELD_NAME(patch_level
, TTCN3_PATCHLEVEL
);
134 int FIELD_NAME(runtime
, TITAN_RUNTIME_NR
);
137 extern const struct runtime_version current_runtime_version
;
140 class RuntimeVersionChecker
{
142 RuntimeVersionChecker(int ver_major
, int ver_minor
, int patch_level
, int rt
);