1 /* 2 * Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved. 3 * 4 * SPDX-License-Identifier: BSD-3-Clause 5 */ 6 7 /* 8 * @file gcc/compiler.h 9 * @brief GCC specific primitives for libmetal. 10 */ 11 12 #ifndef __METAL_GCC_COMPILER__H__ 13 #define __METAL_GCC_COMPILER__H__ 14 15 #ifdef __cplusplus 16 extern "C" { 17 #endif 18 19 #define restrict __restrict__ 20 #define metal_align(n) __attribute__((aligned(n))) 21 #define metal_weak __attribute__((weak)) 22 23 #if defined(__STRICT_ANSI__) 24 #define metal_asm __asm__ 25 #else 26 /* 27 * Even though __asm__ is always available in mainline GCC, we use asm in 28 * the non-strict modes for compatibility with other compilers that define 29 * __GNUC__ 30 */ 31 #define metal_asm asm 32 #endif 33 34 #define METAL_PACKED_BEGIN 35 #define METAL_PACKED_END __attribute__((__packed__)) 36 37 #ifndef __deprecated 38 #define __deprecated __attribute__((deprecated)) 39 #endif 40 41 #ifdef __cplusplus 42 } 43 #endif 44 45 #endif /* __METAL_GCC_COMPILER__H__ */ 46