Simplify helpers.h

`__attribute__((noreturn))` has been supported since GCC 2.5, that was
released October 22, 1993. It doesn't make sense to check if the version
is at least that one, we are compiling for C99, that is more modern. [1]

Also, remove the MSVC check. This code is never compiled with it so
there may be problems that need to be solved to make it compile. All
releases cross-compiled from linux. If there is an actual need to
support MSVC, the compiler definitions can be added again.

Also, if the compiler is not supported, the compiler helpers default to
nothing, so the code can still compile.

[1] https://gcc.gnu.org/onlinedocs/

Signed-off-by: Antonio Niño Díaz <antonio_nd@outlook.com>
This commit is contained in:
Antonio Niño Díaz
2018-04-02 22:14:24 +01:00
parent 895d1d5813
commit cbaaec98ca

View File

@@ -9,21 +9,10 @@
#ifndef HELPERS_H
#define HELPERS_H
#if defined(__GNUC__)
#if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ >= 5))
/* GCC 2.5 or newer */
#ifdef __GNUC__
/* GCC or compatible */
#define noreturn __attribute__ ((noreturn))
#endif
#endif
#if defined(_MSC_VER) && !defined(noreturn)
#if _MSC_VER >= 1310
/* MS Visual Studio 2003/.NET Framework 1.1 or newer */
#define noreturn _declspec(noreturn)
#endif
#endif
#if !defined(noreturn)
#else
/* Unsupported, but no need to throw a fit */
#define noreturn
#endif