1/* Modified by Broadcom Corp. Portions Copyright (c) Broadcom Corp, 2012. */ 2#ifndef __LINUX_COMPILER_H 3#error "Please don't include <linux/compiler-gcc.h> directly, include <linux/compiler.h> instead." 4#endif 5 6/* 7 * Common definitions for all gcc versions go here. 8 */ 9 10 11/* Optimization barrier */ 12/* The "volatile" is due to gcc bugs */ 13#define barrier() __asm__ __volatile__("": : :"memory") 14 15#define RELOC_HIDE(ptr, off) \ 16 ({ unsigned long __ptr; \ 17 __asm__ ("" : "=r"(__ptr) : "0"(ptr)); \ 18 (typeof(ptr)) (__ptr + (off)); }) 19 20/* &a[0] degrades to a pointer: a different type from an array */ 21#define __must_be_array(a) BUILD_BUG_ON_ZERO(__same_type((a), &(a)[0])) 22 23/* 24 * Force always-inline if the user requests it so via the .config, 25 * or if gcc is too old: 26 */ 27#if !defined(CONFIG_ARCH_SUPPORTS_OPTIMIZED_INLINING) || \ 28 !defined(CONFIG_OPTIMIZE_INLINING) || (__GNUC__ < 4) 29#if !defined(CONFIG_BUZZZ_FUNC) 30# define inline inline __attribute__((always_inline)) 31# define __inline__ __inline__ __attribute__((always_inline)) 32# define __inline __inline __attribute__((always_inline)) 33#endif /* !CONFIG_BUZZZ_FUNC */ 34#endif 35 36#define __deprecated __attribute__((deprecated)) 37#define __packed __attribute__((packed)) 38#define __weak __attribute__((weak)) 39 40#define __naked __attribute__((naked)) noinline __noclone notrace 41 42#define __noreturn __attribute__((noreturn)) 43 44/* 45 * From the GCC manual: 46 * 47 * Many functions have no effects except the return value and their 48 * return value depends only on the parameters and/or global 49 * variables. Such a function can be subject to common subexpression 50 * elimination and loop optimization just as an arithmetic operator 51 * would be. 52 * [...] 53 */ 54#define __pure __attribute__((pure)) 55#define __aligned(x) __attribute__((aligned(x))) 56#define __printf(a,b) __attribute__((format(printf,a,b))) 57#define noinline __attribute__((noinline)) 58#define __attribute_const__ __attribute__((__const__)) 59#define __maybe_unused __attribute__((unused)) 60#define __always_unused __attribute__((unused)) 61 62#define __gcc_header(x) #x 63#define _gcc_header(x) __gcc_header(linux/compiler-gcc##x.h) 64#define gcc_header(x) _gcc_header(x) 65#include gcc_header(__GNUC__) 66 67#if !defined(__noclone) 68#define __noclone /* not needed */ 69#endif 70