Sync with 5.4.1
[deliverable/titan.core.git] / common / version.h
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 ///////////////////////////////////////////////////////////////////////////////
8 #ifndef VERSION_H
9 #define VERSION_H
10
11 /* Version numbers */
12 #define TTCN3_MAJOR 5
13 #define TTCN3_MINOR 4
14 #define TTCN3_PATCHLEVEL 1
15 //#define TTCN3_BUILDNUMBER 0
16
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
24 */
25 #define TTCN3_VERSION 50401
26
27 /* A monotonically increasing version number.
28 * An official release is deemed to have the highest possible build number (99)
29 */
30 #ifdef TTCN3_BUILDNUMBER
31 #define TTCN3_VERSION_MONOTONE TTCN3_VERSION
32 #else
33 #define TTCN3_VERSION_MONOTONE (TTCN3_VERSION * 100 + 99)
34 #endif
35
36
37 #if defined (SOLARIS)
38 #define PLATFORM_STRING "SOLARIS"
39 #elif defined (SOLARIS8)
40 #define PLATFORM_STRING "SOLARIS8"
41 #elif defined (LINUX)
42 #define PLATFORM_STRING "LINUX"
43 #elif defined (WIN32)
44 /* MINGW is defined only if CYGWIN is defined */
45 #if defined (MINGW)
46 #define PLATFORM_STRING "MINGW"
47 #else
48 #define PLATFORM_STRING "WIN32"
49 #endif
50 #elif defined (FREEBSD)
51 #define PLATFORM_STRING "FREEBSD"
52 #elif defined (INTERIX)
53 #define PLATFORM_STRING "INTERIX"
54 /* TODO more */
55 #endif
56
57
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"
62 #endif
63
64 #define STRINGIFY(x) #x
65 #define STR(x) STRINGIFY(x)
66
67 #if defined(__GNUC__)
68
69 #ifdef __GNUC_PATCHLEVEL__
70 #define GCC_PATCHLEVEL_STRING "." STR(__GNUC_PATCHLEVEL__)
71 #else
72 /* __GNUC_PATCHLEVEL__ appeared in gcc 3.0 */
73 #define GCC_PATCHLEVEL_STRING
74 #endif
75
76 #ifdef __clang__
77 #define CLANG_VERSION (__clang_major__ * 10000 + __clang_minor__ * 100)
78 #else
79 #define GCC_VERSION (__GNUC__ * 10000 + __GNUC_MINOR__ * 100)
80 #endif
81 /* Ignore __GNUC_PATCHLEVEL__ */
82 #define COMPILER_VERSION_STRING " GCC: (GNU) " STR(__GNUC__) "." STR(__GNUC_MINOR__) GCC_PATCHLEVEL_STRING
83
84
85 static const char titan_[] __attribute__ ((section (".titan"))) = \
86 "TITAN: " STR(TTCN3_VERSION) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING;
87
88 #ifdef __cplusplus
89 struct reffer {
90 reffer(const char *);
91 };
92
93 /* Prevents the version string from being optimized away */
94 static const reffer ref_ver(titan_);
95 #endif
96
97 #else /* not a GNU compiler */
98
99 #ifndef __attribute__
100 #define __attribute__(arg)
101 #endif
102
103 #if defined(__SUNPRO_C)
104
105 #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_C)
106
107 #elif defined(__SUNPRO_CC)
108
109 #define COMPILER_VERSION_STRING " SunPro: " STR(__SUNPRO_CC)
110
111 #pragma ident "TITAN: " STR(TTCN3_VERSION) " PLATFORM: " PLATFORM_STRING COMPILER_VERSION_STRING;
112
113 #else
114 /* Luft! unknown compiler */
115 #endif /* not SunPro */
116
117 #endif
118 /* __SUNPRO_CC is an all-in-one value */
119
120
121 #define FN(f,x) requires_ ## f ## _ ## x
122 #define FIELD_NAME(f,x) FN(f,x)
123
124 #ifdef TITAN_RUNTIME_2
125 #define TITAN_RUNTIME_NR 2
126 #else
127 #define TITAN_RUNTIME_NR 1
128 #endif
129
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);
135 };
136
137 extern const struct runtime_version current_runtime_version;
138
139 #ifdef __cplusplus
140 class RuntimeVersionChecker {
141 public:
142 RuntimeVersionChecker(int ver_major, int ver_minor, int patch_level, int rt);
143 };
144 #endif
145
146 #undef FIELD_NAME
147 #undef FN
148
149 #endif
This page took 0.058681 seconds and 5 git commands to generate.