Changed PEGLIB_HAS_CONSTEXPR_SUPPORT TO BE PEGLIB_NO_CONSTEXPR_SUPPORT.

This commit is contained in:
yhirose 2015-07-30 17:23:31 -04:00
parent 56ebcf09bf
commit 552c7012f4
4 changed files with 9 additions and 9 deletions

View File

@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.0)
include_directories(.)
add_definitions("-std=c++1y" -DPEGLIB_HAS_CONSTEXPR_SUPPORT)
add_definitions("-std=c++1y")
add_executable(peglint lint/peglint.cc)
target_link_libraries(peglint pthread)

View File

@ -1,5 +1,5 @@
cmake_minimum_required(VERSION 3.0)
include_directories(..)
add_definitions("-std=c++1y" -DPEGLIB_HAS_CONSTEXPR_SUPPORT)
add_definitions("-std=c++1y")
add_executable(culebra main.cc)

View File

@ -59,7 +59,7 @@
</PrecompiledHeader>
<WarningLevel>Level3</WarningLevel>
<Optimization>Disabled</Optimization>
<PreprocessorDefinitions>PEGLIB_HAS_CONSTEXPR_SUPPORT;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>
@ -76,7 +76,7 @@
<Optimization>MaxSpeed</Optimization>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<PreprocessorDefinitions>PEGLIB_HAS_CONSTEXPR_SUPPORT;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<AdditionalIncludeDirectories>../..</AdditionalIncludeDirectories>
</ClCompile>
<Link>

View File

@ -1945,7 +1945,7 @@ private:
const int AstDefaultTag = -1;
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
#ifndef PEGLIB_NO_CONSTEXPR_SUPPORT
inline constexpr unsigned int str2tag(const char* str, int h = 0) {
return !str[h] ? 5381 : (str2tag(str, h + 1) * 33) ^ str[h];
}
@ -1959,14 +1959,14 @@ struct Ast
{
Ast(const char* path, size_t line, size_t column, const char* name, const std::vector<std::shared_ptr<Ast>>& nodes)
: path(path ? path : ""), line(line), column(column), name(name), original_name(name), is_token(false), nodes(nodes)
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
#ifndef PEGLIB_NO_CONSTEXPR_SUPPORT
, tag(str2tag(name)), original_tag(tag)
#endif
{}
Ast(const char* path, size_t line, size_t column, const char* name, const std::string& token)
: path(path ? path : ""), line(line), column(column), name(name), original_name(name), is_token(true), token(token)
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
#ifndef PEGLIB_NO_CONSTEXPR_SUPPORT
, tag(str2tag(name)), original_tag(tag)
#endif
{}
@ -1974,7 +1974,7 @@ struct Ast
Ast(const Ast& ast, const char* original_name)
: path(ast.path), line(ast.line), column(ast.column), name(ast.name), original_name(original_name)
, is_token(ast.is_token), token(ast.token), nodes(ast.nodes)
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
#ifndef PEGLIB_NO_CONSTEXPR_SUPPORT
, tag(ast.tag), original_tag(str2tag(original_name))
#endif
{}
@ -1992,7 +1992,7 @@ struct Ast
const std::string token;
const std::vector<std::shared_ptr<Ast>> nodes;
std::shared_ptr<Ast> parent_node;
#ifdef PEGLIB_HAS_CONSTEXPR_SUPPORT
#ifndef PEGLIB_NO_CONSTEXPR_SUPPORT
const unsigned int tag;
const unsigned int original_tag;
#endif