Newer
Older
snipet / kyscript / trunk / lib / nstdc / include / nstdc_compiler.h
/**
 * @file      nstdc_compiler.h
 * @brief     C/C++の言語のバージョンを判定するマクロを定義したヘッダファイル
 * @author    Nomura Kei
 * @copyright 2003 - 2017  Nomura Kei
 */
#ifndef NSTDC_COMPILER_H
#define NSTDC_COMPILER_H

#include <nstdc.h>


#if __cplusplus
/* -----------------------------------------------------------------------------
 *  C++
 * -----------------------------------------------------------------------------
 */
#define is_supported_cpp17full()	(__cplusplus >= 201703L)
#define is_supported_cpp17()		(__cplusplus >= 201500L)
#define is_supported_cpp14full()	(__cplusplus >= 201402L)
#define is_supported_cpp14()		(__cplusplus >= 201305L)
#define is_supported_cpp11()		(__cplusplus >= 201103L)
#define is_supported_c11()			(0)
#define is_supported_c99()			(0)

#elif defined(__STDC_VERSION__)
/* -----------------------------------------------------------------------------
 *  C
 * -----------------------------------------------------------------------------
 */
#define is_supported_cpp17full()	(0)
#define is_supported_cpp17()		(0)
#define is_supported_cpp14full()	(0)
#define is_supported_cpp14()		(0)
#define is_supported_cpp11()		(0)
#define is_supported_c11()			(__STDC_VERSION__ >= 201112L)
#define is_supported_c99()			(__STDC_VERSION__ >= 199901L)

#else
/* -----------------------------------------------------------------------------
 *  C99 以前のものは未サポート
 * -----------------------------------------------------------------------------
 */
#error "unsupported compiler, please use c99 or later"

#endif	/* __cplusplus		*/


#endif	/* NSTDC_COMPILER_H	*/