1 /******************************************************************************
2 * Copyright (c) 2000-2016 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
17 * Szabo, Janos Zoltan – initial implementation
20 ******************************************************************************/
27 #define TTCN3_PATCHLEVEL 0
28 //#define TTCN3_BUILDNUMBER 0
30 /* The aggregated version number must be set manually since some stupid
31 * 'makedepend' programs cannot calculate arithmetic expressions.
32 * In official releases:
33 * TTCN3_VERSION = TTCN3_MAJOR * 10000 + TTCN3_MINOR * 100 + TTCN3_PATCHLEVEL
34 * In pre-release builds:
35 * TTCN3_VERSION = TTCN3_MAJOR * 1000000 + TTCN3_MINOR * 10000 +
36 * TTCN3_PATCHLEVEL * 100 + TTCN3_BUILDNUMBER
38 #define TTCN3_VERSION 50500
40 /* A monotonically increasing version number.
41 * An official release is deemed to have the highest possible build number (99)
43 #ifdef TTCN3_BUILDNUMBER
44 #define TTCN3_VERSION_MONOTONE TTCN3_VERSION
46 #define TTCN3_VERSION_MONOTONE (TTCN3_VERSION * 100 + 99)
51 #define PLATFORM_STRING "SOLARIS"
52 #elif defined (SOLARIS8)
53 #define PLATFORM_STRING "SOLARIS8"
55 #define PLATFORM_STRING "LINUX"
57 /* MINGW is defined only if CYGWIN is defined */
59 #define PLATFORM_STRING "MINGW"
61 #define PLATFORM_STRING "WIN32"
63 #elif defined (FREEBSD)
64 #define PLATFORM_STRING "FREEBSD"
65 #elif defined (INTERIX)
66 #define PLATFORM_STRING "INTERIX"
71 #ifndef PLATFORM_STRING
72 /* Just to suppress error later */
73 #define PLATFORM_STRING "UNKNOWN"
74 #error "No supported platform has been defined in the Makefile. The supported ones: SOLARIS, SOLARIS8, LINUX, WIN32"
77 #define STRINGIFY(x) #x
78 #define STR(x) STRINGIFY(x)
82 #ifdef __GNUC_PATCHLEVEL__
83 #define GCC_PATCHLEVEL_STRING "." STR(__GNUC_PATCHLEVEL__)
85 /* __GNUC_PATCHLEVEL__ appeared in gcc 3.0 */
86 #define GCC_PATCHLEVEL_STRING
90 #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100)
92 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
94 /* Ignore __GNUC_PATCHLEVEL__ */
95 #define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING
98 static const char titan_
[] __attribute__ ((section (".titan"))) = \
99 "TITAN: " STR(TTCN3_VERSION
) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING
;
103 reffer(const char *);
106 /* Prevents the version string from being optimized away */
107 static const reffer
ref_ver(titan_
);
110 #else /* not a GNU compiler */
112 #ifndef __attribute__
113 #define __attribute__(arg)
116 #if defined(__SUNPRO_C)
118 #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_C)
120 #elif defined(__SUNPRO_CC)
122 #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_CC)
124 #pragma ident "TITAN: " STR(TTCN3_VERSION) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING;
127 /* Luft! unknown compiler */
128 #endif /* not SunPro */
131 /* __SUNPRO_CC is an all-in-one value */
134 #define FN(f,x) requires_ ## f ## _ ## x
135 #define FIELD_NAME(f,x) FN(f,x)
137 #ifdef TITAN_RUNTIME_2
138 #define TITAN_RUNTIME_NR 2
140 #define TITAN_RUNTIME_NR 1
143 struct runtime_version
{
144 int FIELD_NAME(major_version
, TTCN3_MAJOR
);
145 int FIELD_NAME(minor_version
, TTCN3_MINOR
);
146 int FIELD_NAME(patch_level
, TTCN3_PATCHLEVEL
);
147 int FIELD_NAME(runtime
, TITAN_RUNTIME_NR
);
150 extern const struct runtime_version current_runtime_version
;
153 class RuntimeVersionChecker
{
155 RuntimeVersionChecker(int ver_major
, int ver_minor
, int patch_level
, int rt
);