1 #ifndef _COMPILER_H_
2 #define _COMPILER_H_
3 
4 /*
5  * Copyright (c) 2014, Mentor Graphics Corporation
6  * All rights reserved.
7  * Copyright (c) 2016 Freescale Semiconductor, Inc. All rights reserved.
8  *
9  * SPDX-License-Identifier: BSD-3-Clause
10  */
11 
12 /**************************************************************************
13  * FILE NAME
14  *
15  *       compiler.h
16  *
17  * DESCRIPTION
18  *
19  *       This file defines compiler-specific macros.
20  *
21  ***************************************************************************/
22 #if defined __cplusplus
23 extern "C" {
24 #endif
25 
26 /* IAR ARM build tools */
27 #if defined(__ICCARM__)
28 
29 #ifndef OPENAMP_PACKED_BEGIN
30 #define OPENAMP_PACKED_BEGIN __packed
31 #endif
32 
33 #ifndef OPENAMP_PACKED_END
34 #define OPENAMP_PACKED_END
35 #endif
36 
37 /* GNUC */
38 #elif defined(__GNUC__)
39 
40 #ifndef OPENAMP_PACKED_BEGIN
41 #define OPENAMP_PACKED_BEGIN
42 #endif
43 
44 #ifndef OPENAMP_PACKED_END
45 #define OPENAMP_PACKED_END __attribute__((__packed__))
46 #endif
47 
48 /* ARM GCC */
49 #elif defined(__CC_ARM)
50 
51 #ifndef OPENAMP_PACKED_BEGIN
52 #define OPENAMP_PACKED_BEGIN _Pragma("pack(1U)")
53 #endif
54 
55 #ifndef OPENAMP_PACKED_END
56 #define OPENAMP_PACKED_END _Pragma("pack()")
57 #endif
58 
59 #else
60 /*
61  * There is no default definition here to avoid wrong structures packing in case
62  * of not supported compiler
63  */
64 #error Please implement the structure packing macros for your compiler here!
65 #endif
66 
67 #if defined __cplusplus
68 }
69 #endif
70 
71 #endif /* _COMPILER_H_ */
72