Files
exectos/sdk/xtdk/xtcompat.h
Aiken Harris aae31c2b1d
Some checks failed
Builds / ExectOS (amd64, release) (push) Failing after 30s
Builds / ExectOS (i686, debug) (push) Failing after 29s
Builds / ExectOS (i686, release) (push) Failing after 36s
Builds / ExectOS (amd64, debug) (push) Failing after 38s
Define cross-language attribute macros
2026-07-09 08:36:18 +02:00

60 lines
1.4 KiB
C

/**
* PROJECT: ExectOS
* COPYRIGHT: See COPYING.md in the top level directory
* FILE: sdk/xtdk/xtcompat.h
* DESCRIPTION: C/C++ compatibility macros
* DEVELOPERS: Aiken Harris <harraiken91@gmail.com>
*/
#ifndef __XTDK_XTCOMPAT_H
#define __XTDK_XTCOMPAT_H
/* C/C++ specific code */
#ifndef __XTOS_ASSEMBLER__
#ifdef __cplusplus
/* C++ definitions */
#define NULLPTR nullptr
#define VIRTUAL virtual
#define XTCLINK extern "C"
#define XTSYMBOL(Name) __asm__(Name)
/* C++ attributes */
#define MUSTCHECK [[nodiscard]]
#define NORETURN [[noreturn]]
#define UNUSED [[maybe_unused]]
/* C++ boolean type */
typedef bool BOOLEAN, *PBOOLEAN;
#define TRUE true
#define FALSE false
/* C++ widechar type */
typedef wchar_t wchar;
#else
/* C definitions */
#define NULLPTR ((void *)0)
#define VIRTUAL
#define XTCLINK
#define XTSYMBOL(Name)
/* C attributes */
#define MUSTCHECK __attribute__((warn_unused_result))
#define NORETURN __attribute__((noreturn))
#define UNUSED __attribute__((unused))
/* C boolean type */
typedef enum _BOOLEAN
{
FALSE = 0,
TRUE = 1
} BOOLEAN, *PBOOLEAN;
/* C widechar type */
typedef unsigned short wchar;
#endif
#endif /* __XTOS_ASSEMBLER__ */
#endif /* __XTDK_XTCOMPAT_H */