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


#if (__cplusplus >= 201103L)
/* ----- C++11 以降の場合のみサポートする	*/
#define IS_SUPPORTED_CPP20		(__cplusplus >= 202002L)
#define IS_SUPPORTED_CPP17		(__cplusplus >= 201703L)
#define IS_SUPPORTED_CPP14		(__cplusplus >= 201402L)
#define IS_SUPPORTED_CPP11		(__cplusplus >= 201103L)
#define IS_SUPPORTED_C17		(0)
#define IS_SUPPORTED_C11		(0)
#define IS_SUPPORTED_C99		(0)

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

#endif	/* (__cplusplus >= 201103L)			*/


#endif	/* __cplusplus						*/
#endif	/* SCPP_COMPILER_H					*/