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#else
26# define GP_WUR
30# define GP_FMT_PRINTF(fmt, list)
34# define GP_FMT_SCANF(fmt, list)
38# define GP_IS_CONSTANT(x) 0
42# define GP_LIKELY(cond) (cond)
46# define GP_UNLIKELY(cond) (cond)
50# define GP_UNUSED(x) x
51#endif
52
53#endif /* CORE_GP_COMPILER_H */