ReactOS
0.4.16-dev-1946-g52006dd
compiler.h
Go to the documentation of this file.
1
#pragma once
2
3
/*
4
* Compiler-specific attributes/macros go here. This is the default placeholder
5
* that should work for MSVC/GCC/clang.
6
*/
7
8
#ifdef UACPI_OVERRIDE_COMPILER
9
#include "uacpi_compiler.h"
10
#else
11
12
#define UACPI_ALIGN(x) __declspec(align(x))
13
14
#ifdef _MSC_VER
15
#include <intrin.h>
16
17
#define UACPI_ALWAYS_INLINE __forceinline
18
19
#define UACPI_PACKED(decl) \
20
__pragma(pack(push, 1)) \
21
decl; \
22
__pragma(pack(pop))
23
#else
24
#define UACPI_ALWAYS_INLINE inline __attribute__((always_inline))
25
#define UACPI_PACKED(decl) decl __attribute__((packed));
26
#endif
27
28
#if defined(__GNUC__) || defined(__clang__)
29
#define uacpi_unlikely(expr) __builtin_expect(!!(expr), 0)
30
#define uacpi_likely(expr) __builtin_expect(!!(expr), 1)
31
32
#if __has_attribute(__fallthrough__)
33
#define UACPI_FALLTHROUGH __attribute__((__fallthrough__))
34
#endif
35
36
#define UACPI_MAYBE_UNUSED __attribute__ ((unused))
37
38
#define UACPI_NO_UNUSED_PARAMETER_WARNINGS_BEGIN \
39
_Pragma("GCC diagnostic push"
) \
40
_Pragma("GCC diagnostic ignored \"-Wunused-parameter\"")
41
42
#define UACPI_NO_UNUSED_PARAMETER_WARNINGS_END \
43
_Pragma("GCC diagnostic pop"
)
44
45
#ifdef __clang__
46
#define UACPI_PRINTF_DECL(fmt_idx, args_idx) \
47
__attribute__((format(printf, fmt_idx, args_idx)))
48
#else
49
#define UACPI_PRINTF_DECL(fmt_idx, args_idx) \
50
__attribute__((format(gnu_printf, fmt_idx, args_idx)))
51
#endif
52
53
#define UACPI_COMPILER_HAS_BUILTIN_MEMCPY
54
#define UACPI_COMPILER_HAS_BUILTIN_MEMMOVE
55
#define UACPI_COMPILER_HAS_BUILTIN_MEMSET
56
#define UACPI_COMPILER_HAS_BUILTIN_MEMCMP
57
#else
58
#define uacpi_unlikely(expr) expr
59
#define uacpi_likely(expr) expr
60
61
#define UACPI_MAYBE_UNUSED
62
63
#define UACPI_NO_UNUSED_PARAMETER_WARNINGS_BEGIN
64
#define UACPI_NO_UNUSED_PARAMETER_WARNINGS_END
65
66
#define UACPI_PRINTF_DECL(fmt_idx, args_idx)
67
#endif
68
69
#ifndef UACPI_FALLTHROUGH
70
#define UACPI_FALLTHROUGH do {} while (0)
71
#endif
72
73
#ifndef UACPI_POINTER_SIZE
74
#ifdef _WIN32
75
#ifdef _WIN64
76
#define UACPI_POINTER_SIZE 8
77
#else
78
#define UACPI_POINTER_SIZE 4
79
#endif
80
#elif defined(__GNUC__)
81
#define UACPI_POINTER_SIZE __SIZEOF_POINTER__
82
#else
83
#error Failed to detect pointer size
84
#endif
85
#endif
86
87
#endif
drivers
bus
acpi_new
uacpi
include
uacpi
platform
compiler.h
Generated on Thu Dec 4 2025 06:16:05 for ReactOS by
1.9.6