/*---------------------------------------------------------------------------* Project: Horizon File: ghs.h Copyright (C) 2009-2011 Nintendo. All rights reserved. These coded instructions, statements, and computer programs contain proprietary information of Nintendo of America Inc. and/or Nintendo Company Ltd., and are protected by Federal copyright law. They may not be disclosed to third parties or copied or duplicated in any form, in whole or in part, without the prior written consent of Nintendo. $Rev: 27772 $ *---------------------------------------------------------------------------*/ /*! @file :include nn/config.h */ #ifndef NN_CONFIG_COMPILER_GHS_H_ #define NN_CONFIG_COMPILER_GHS_H_ //! @addtogroup nn_config Environment Macros //! @brief These macros represent environment information. They are used to change the implementation depending on the environment. //! @{ //--------------------------------------------------------------------------- //! @brief Specifies the current source filename. //! //! Unlike __FILE__, this consists only of a filename. //! No directory path is included. //--------------------------------------------------------------------------- #define NN_FILE_NAME __FILE__ //--------------------------------------------------------------------------- //! @brief Specifies the current function name. //! //! Represents a more detailed function name than _FUNCTION_. //--------------------------------------------------------------------------- #define NN_FUNCTION __PRETTY_FUNCTION__ //--------------------------------------------------------------------------- //! @param[in] n Specifies the alignment. //! //! @brief Used to align the boundaries of object addresses. //! //! Ensures that the start addresses of global objects are aligned on n-byte boundaries by padding the ends of the objects. //! //--------------------------------------------------------------------------- #define NN_ATTRIBUTE_ALIGN(n) __attribute__ ((aligned(n))) //--------------------------------------------------------------------------- //! @param[in] var Specifies the variable. //! //! @brief Declares that a variable is not used. //! //! If a variable is declared in the code but not referenced, it generates a compiler warning. This macro eliminates this warning by declaring the variable as unused. //! //! //! Such variables are primarily used as temporary function parameters. //--------------------------------------------------------------------------- #define NN_UNUSED_VAR(var) ((void)&var); //! @} //--------------------------------------------------------------------------- // @brief Explicitly creates a reference to a symbol. // // Put this macro in front of a variable or function declaration to ensure that a symbol reference is always generated. // //--------------------------------------------------------------------------- #define NN_DLL_IMPORT __declspec(dllimport) //--------------------------------------------------------------------------- // @brief Explicitly exports a symbol. // // Put this macro in front of a variable or function definition to ensure the symbol is exported, even if it has no references. // //--------------------------------------------------------------------------- #define NN_DLL_EXPORT __declspec(dllexport) #define NN_IS_UNUSED_VAR __attribute__((unused)) #define NN_IS_UNUSED_FUNC __attribute__((unused)) #define NN_WEAK_SYMBOL //__weak #define NN_ASM __asm #define NN_PACKED __packed #define NN_FORCE_INLINE __forceinline #define NN_ATTRIBUTE_PACK __attribute__ ((packed)) #define NN_ATTRIBUTE_DEPRECATED __attribute__ ((deprecated)) #define NN_ATTRIBUTE_FORMAT(type, m, n) \ __attribute__ ((format(type,m,n))) #define NN_ATTRIBUTE_NORETURN __attribute__ ((noreturn)) #define NN_LSYM( no ) no #define NN_BSYM( no ) %b##no #define NN_FSYM( no ) %f##no // NOTE: Note that the same symbol is defined in nn/middleware.h. // This header must be organized if it is to be released to the public. #define NN_DEFINE_MODULE_ID_STRING(name, value) \ static const char name[] __attribute__((section(".module_id"))) = (value) #define NN_DEFINE_STATIC_INIT_ARRAY(array, symbol) \ static void (*const array[])() __attribute__((used, section(".static_init"))) = { &symbol } #define NN_ATTR_PRIVATE_SECTION_2(a, b) \ __attribute__((section(#a "." #b))) #define NN_ATTR_PRIVATE_SECTION_1(a, b) \ NN_ATTR_PRIVATE_SECTION_2(a, b) #define NN_ATTR_PRIVATE_SECTION \ NN_ATTR_PRIVATE_SECTION_1(NN_FILE_NAME, __LINE__) #define NN_FUNC_ATTR_PRIVATE_SECTION NN_ATTR_PRIVATE_SECTION // TORIAEZU: Strange for it to be here because there is no compiler dependency. #define NN_PADDING1 int : 8 #define NN_PADDING2 int : 16 #define NN_PADDING3 int : 24 #define NN_PADDING4 int : 32 /* NN_CONFIG_COMPILER_GHS_H_ */ #endif