e754dd54ba
* Reduce alignment to 16 due to stack variables alignment
On some archs (e.g. elbrus) there is no possibility to align
variables on stack by more that 16 bytes.
* Added check for -Wno-typedef-redefinition
In C11, there is legal to redefine typedef with the same type,
but some compilers like elbrus's lcc and, probably, intel's icc
generate a warning about that. So we disable it.
* Typo fix
* Fix __builtin_unreachable() warning on some frontends like EDG
* Added check for __attribute__((designated_init))
It doesn't work for elbrus'c lcc and clang; but clang does not
generate warning by default, but we still disable it just in case.
* A hack to avoid -Wtype-limits for compilers with unsigned enums
* Rewritten unreachable __builtin_unreachable() behavior.
According to https://bugs.llvm.org/show_bug.cgi?id=13910,
old clang versions also suffer from this issue along with lcc.
And also this warning option is removed from gcc since 4.5.0,
and it's likely there is no unreachable code analysis at all:
https://gcc.gnu.org/onlinedocs/gcc-4.5.0/gcc/Warning-Options.html
* Fixed unneeded stray UNREACHABLE which caused warnings
* Removed alignas() which is unneeded after lowering alignment requirements
* Removed a hack of -Wunreachable-code disabling on certain compilers
Actually, there was a wrong opinion that most of unreachable code
warnings are produced by __builtin_unreachable() itself,
not the certain use of it. After commit 36493d3
, it is finally
figured out that it wasn't the case.
* Added dummy element to a struct in a test for designated_init
This test will enexpectedly fail when GNU extensions are not available
65 lines
1.8 KiB
C
65 lines
1.8 KiB
C
/*
|
|
* This software is licensed under the terms of the MIT-License
|
|
* See COPYING for further information.
|
|
* ---
|
|
* Copyright (c) 2011-2019, Lukas Weber <laochailan@web.de>.
|
|
* Copyright (c) 2012-2019, Andrei Alexeyev <akari@alienslab.net>.
|
|
*/
|
|
|
|
#ifndef IGUARD_version_h
|
|
#define IGUARD_version_h
|
|
|
|
#include "taisei.h"
|
|
|
|
#include "util.h"
|
|
|
|
extern const char *const TAISEI_VERSION;
|
|
extern const char *const TAISEI_VERSION_FULL;
|
|
extern const char *const TAISEI_VERSION_BUILD_TYPE;
|
|
|
|
extern const uint8_t TAISEI_VERSION_MAJOR;
|
|
extern const uint8_t TAISEI_VERSION_MINOR;
|
|
extern const uint8_t TAISEI_VERSION_PATCH;
|
|
extern const uint16_t TAISEI_VERSION_TWEAK;
|
|
|
|
typedef struct TaiseiVersion {
|
|
uint8_t major;
|
|
uint8_t minor;
|
|
uint8_t patch;
|
|
uint16_t tweak;
|
|
} TaiseiVersion;
|
|
|
|
#define TAISEI_VERSION_SET(v,ma,mi,pa,tw) { \
|
|
(v)->major = (ma); \
|
|
(v)->minor = (mi); \
|
|
(v)->patch = (pa); \
|
|
(v)->tweak = (tw); \
|
|
}
|
|
|
|
#define TAISEI_VERSION_GET_CURRENT(v) TAISEI_VERSION_SET(v, \
|
|
TAISEI_VERSION_MAJOR, \
|
|
TAISEI_VERSION_MINOR, \
|
|
TAISEI_VERSION_PATCH, \
|
|
TAISEI_VERSION_TWEAK \
|
|
)
|
|
|
|
typedef enum {
|
|
// Start filling this enum from nonzero value.
|
|
// This would help avoid a warning on some compilers like
|
|
// those with EDG frontend. Actual values of VCMP_...
|
|
// don't matter, the thing which does matter is its order.
|
|
VCMP_MAJOR = 1,
|
|
VCMP_MINOR,
|
|
VCMP_PATCH,
|
|
VCMP_TWEAK,
|
|
} TaiseiVersionCmpLevel;
|
|
|
|
// this is for IO purposes. sizeof(TaiseiVersion) may not match.
|
|
#define TAISEI_VERSION_SIZE (sizeof(uint8_t) * 3 + sizeof(uint16_t))
|
|
|
|
int taisei_version_compare(TaiseiVersion *v1, TaiseiVersion *v2, TaiseiVersionCmpLevel level);
|
|
char* taisei_version_tostring(TaiseiVersion *version);
|
|
size_t taisei_version_read(SDL_RWops *rwops, TaiseiVersion *version);
|
|
size_t taisei_version_write(SDL_RWops *rwops, TaiseiVersion *version);
|
|
|
|
#endif // IGUARD_version_h
|