Newer
Older
project / modules / libsc / include / sc_compiler.h
Nomura Kei on 3 Oct 2022 1 KB UPDATE
/**
 * @file      sc_compiler.h
 * @bried     C言語バージョン判定マクロを定義したヘッダーファイル
 * @author    Nomura Kei
 * @copyright 2003 - 2022  Nomura Kei
 *
 * C言語バージョンに応じてて次のマクロが定義されます。
 * - IS_SUPPORTED_C17
 * - IS_SUPPORTED_C11
 *
 * C言語の場合、次の値は常に 0 となります。
 * - IS_SUPPORTED_CPP20
 * - IS_SUPPORTED_CPP17
 * - IS_SUPPORTED_CPP14
 * - IS_SUPPORTED_CPP11
 *
 */
#ifndef SC_COMPILER_H
#define SC_COMPILER_H
#ifndef __cplusplus


#if defined(__STDC_VERSION__)
#if (__STDC_VERSION__ >= 201112L)
/* ----- C11 以降の場合のみサポートする			*/
#define IS_SUPPORTED_CPP20		(0)
#define IS_SUPPORTED_CPP17		(0)
#define IS_SUPPORTED_CPP14		(0)
#define IS_SUPPORTED_CPP11		(0)
#define IS_SUPPORTED_C17		(__STDC_VERSION__ >= 201710L)
#define IS_SUPPORTED_C11		(__STDC_VERSION__ >= 201112L)


#else
/* ----- C11 以前の場合はエラーとする		*/
#error "unsupported c version, please use c11 or later"

#endif	/* (__STDC_VERSION__ >= 201112L)		*/

#else
#error "unsupported c version, please use c11 or later (not found __STDC_VERSION__)"

#endif	/* defined(__STDC_VERSION__)		*/ 


#endif	/* !__cplusplus						*/
#endif	/* SC_COMPILER_H					*/