1
0
Fork 0

Move GCC_ATTRIBUTE out of autoconf

This commit is contained in:
Patryk Obara 2019-12-29 15:49:30 +01:00 committed by Patryk Obara
parent 670654fc7b
commit aff02450d1
3 changed files with 19 additions and 8 deletions

View file

@ -334,9 +334,3 @@ AH_BOTTOM([#if C_ATTRIBUTE_FASTCALL
#else
#define DB_FASTCALL
#endif])
AH_BOTTOM([#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) __attribute__ ((x))
#else
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif])

View file

@ -22,6 +22,25 @@
// This header wraps compiler-specific features, so they won't need to
// be hacked into the buildsystem.
// Modern C++ compilers have better support for feature testing using GNU
// extension __has_attribute but C++20 introduces even better alternative:
// standard-defined __has_cpp_attribute, which will remove the need for
// defining C_HAS_* macros on a buildsystem level (at some point).
// The __attribute__ syntax is supported by GCC, Clang, and IBM compilers.
//
// TODO: C++11 introduces standard syntax for implementation-defined attributes,
// it should allow for removal of C_HAS_ATTRIBUTE from the buildsystem.
// However, the vast majority of GCC_ATTRIBUTEs in DOSBox code need
// to be reviewed, as many of them seem to be incorrectly/unnecessarily
// used.
#if C_HAS_ATTRIBUTE
#define GCC_ATTRIBUTE(x) __attribute__ ((x))
#else
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#endif
// GCC_LIKELY macro is incorrectly named, because other compilers support
// this feature as well (e.g. Clang, Intel); leave it be for now, at
// least until full support for C++20 [[likely]] attribute will start arriving

View file

@ -63,8 +63,6 @@
/* Define to 1 if you want serial passthrough support. */
#define C_DIRECTSERIAL 1
#define GCC_ATTRIBUTE(x) /* attribute not supported */
#define INLINE __forceinline
#define DB_FASTCALL __fastcall