Newer
Older
snipet / project / trunk / include / sc / sc_compiler.h
/* =============================================================================
 *  sc_compiler.h
 *  Copyright (c) 2003 - 2013  Nomura Kei
 * =============================================================================
 */
#ifndef SC_COMPILER_H
#define SC_COMPILER_H

#ifndef CONFIG_H
#include <config.h>
#endif


/* =============================================================================
 *  C言語用定義
 * =============================================================================
 */
#if (IS_C99)
/* -----------------------------------------------------------------------------
 *  C99 対応 コンパイラ
 * -----------------------------------------------------------------------------
 */



#else
/* -----------------------------------------------------------------------------
 *  C99 非対応 コンパイラ
 * -----------------------------------------------------------------------------
 */

#if (__GNUC__ >= 2)
/** 関数名を表す.	*/
#define __func__ __FUNCTION__
#else
/** 関数名を表す.(コンパイラ非対応のため常に "<unknown>" の文字列となる.) */
#define __func__ "<unknown>"
#endif	/* __GNUC__ >= 2 */

#endif /* IS_C99 */




/* -----------------------------------------------------------------------------
 *  GCC 関連
 * -----------------------------------------------------------------------------
 */
#ifdef __GNUC__

#else	/* !__GNUC__	*/
/** 関数名(拡張版)を表す.	*/
#define __PRETTY_FUNCTION__ __func__

#endif	/* __GNUC__		*/


#ifndef _POSIX_C_SOURCE
/** POSIX_C_SOURCE 非対応.	*/
#define _POSIX_C_SOURCE (0)
#endif


#ifndef _XOPEN_SOURCE
/** _XOPEN_SOURCE 非対応.	*/
#define _XOPEN_SOURCE (0)
#endif



#ifdef __cplusplus
/* -----------------------------------------------------------------------------
 *  C++
 * -----------------------------------------------------------------------------
 */
#if (__cplusplus >= 201103L)
#define NO_THROW() noexcept()		/*< 例外を投げないことを示す.	*/
#else
#define NO_THROW() throw()			/*< 例外を投げないことを示す.	*/
#endif

#endif /* __cplusplus */

#endif	/* SC_COMPILER_H */