GFXprim
2D bitmap graphics library with emphasis on speed and correctness
Loading...
Searching...
No Matches
gp_compiler.h
Go to the documentation of this file.
1// SPDX-License-Identifier: LGPL-2.1-or-later
2/*
3 * Copyright (C) 2024 Cyril Hrubis <metan@ucw.cz>
4 */
5
11#ifndef CORE_GP_COMPILER_H
12#define CORE_GP_COMPILER_H
13
14#if __GNUC__
15# define GP_IS_CONSTANT(x) __builtin_constant_p(x)
16# define GP_WUR __attribute__((warn_unused_result))
17# define GP_FMT_PRINTF(fmt, list) __attribute__((format(printf, fmt, list)))
18# define GP_FMT_SCANF(fmt, list) __attribute__((format(scanf, fmt, list)))
19# define GP_LIKELY(cond) __builtin_expect(!!(cond), 1)
20# define GP_UNLIKELY(cond) __builtin_expect(!!(cond), 0)
21# define GP_UNUSED(x) (x)__attribute__ ((unused))
22# define GP_PACKED __attribute__ ((packed))
23#else
27# define GP_WUR
31# define GP_FMT_PRINTF(fmt, list)
35# define GP_FMT_SCANF(fmt, list)
39# define GP_IS_CONSTANT(x) 0
43# define GP_LIKELY(cond) (cond)
47# define GP_UNLIKELY(cond) (cond)
51# define GP_UNUSED(x) x
55# define GP_PACKED
56#endif
57
58#endif /* CORE_GP_COMPILER_H */