15ff74ecaSNigel Croxon /*++ 25ff74ecaSNigel Croxon 35ff74ecaSNigel Croxon Copyright (c) 2016 Pete Batard <pete@akeo.ie> 45ff74ecaSNigel Croxon 55ff74ecaSNigel Croxon Module Name: 65ff74ecaSNigel Croxon 75ff74ecaSNigel Croxon eficompiler.h 85ff74ecaSNigel Croxon 95ff74ecaSNigel Croxon Abstract: 105ff74ecaSNigel Croxon 115ff74ecaSNigel Croxon Compiler specific adjustments 125ff74ecaSNigel Croxon 135ff74ecaSNigel Croxon --*/ 145ff74ecaSNigel Croxon 155ff74ecaSNigel Croxon #ifdef _MSC_EXTENSIONS 165ff74ecaSNigel Croxon #define EFI_UNUSED 175ff74ecaSNigel Croxon #else 185ff74ecaSNigel Croxon #define EFI_UNUSED __attribute__((__unused__)) 195ff74ecaSNigel Croxon #endif 205ff74ecaSNigel Croxon 215ff74ecaSNigel Croxon #ifdef _MSC_EXTENSIONS 226f333cfcSCallum Farmer #define EFI_NO_TAIL_CALL 236f333cfcSCallum Farmer #else 246f333cfcSCallum Farmer #ifdef __clang__ 256f333cfcSCallum Farmer #define EFI_NO_TAIL_CALL __attribute__((disable_tail_calls)) 266f333cfcSCallum Farmer #else 276f333cfcSCallum Farmer #define EFI_NO_TAIL_CALL __attribute__((optimize("no-optimize-sibling-calls"))) 286f333cfcSCallum Farmer #endif 296f333cfcSCallum Farmer #endif 306f333cfcSCallum Farmer 316f333cfcSCallum Farmer #ifdef _MSC_EXTENSIONS 32*bbffe42bSCallum Farmer #define EFI_OPTNONE 33*bbffe42bSCallum Farmer #else 34*bbffe42bSCallum Farmer #ifdef __clang__ 35*bbffe42bSCallum Farmer #define EFI_OPTNONE __attribute__((optnone)) 36*bbffe42bSCallum Farmer #else 37*bbffe42bSCallum Farmer #define EFI_OPTNONE __attribute__((__optimize__("0"))) 38*bbffe42bSCallum Farmer #endif 39*bbffe42bSCallum Farmer #endif 40*bbffe42bSCallum Farmer 41*bbffe42bSCallum Farmer #ifdef _MSC_EXTENSIONS 425ff74ecaSNigel Croxon #define ALIGN(x) __declspec(align(x)) 435ff74ecaSNigel Croxon #else 445ff74ecaSNigel Croxon #define ALIGN(x) __attribute__((__aligned__(x))) 455ff74ecaSNigel Croxon #endif 465ff74ecaSNigel Croxon 475ff74ecaSNigel Croxon /* Also add a catch-all on __attribute__() for MS compilers */ 485ff74ecaSNigel Croxon #ifdef _MSC_EXTENSIONS 495ff74ecaSNigel Croxon #define __attribute__(x) 505ff74ecaSNigel Croxon #endif 51