summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/arm64/bti/compiler.h
blob: ebb6204f447a097baac56b14d85727d3833007bd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/* SPDX-License-Identifier: GPL-2.0 */
/*
 * Copyright (C) 2019  Arm Limited
 * Original author: Dave Martin <Dave.Martin@arm.com>
 */

#ifndef COMPILER_H
#define COMPILER_H

#define __always_unused __attribute__((__unused__))
#define __noreturn __attribute__((__noreturn__))
#define __unreachable() __builtin_unreachable()

/* curse(e) has value e, but the compiler cannot assume so */
#define curse(e) ({				\
	__typeof__(e) __curse_e = (e);		\
	asm ("" : "+r" (__curse_e));		\
	__curse_e;				\
})

#endif /* ! COMPILER_H */