Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use MARISA_DEBUG_IF in scoped-*.h as opposed to MARISA_THROW_IF #1

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/marisa/scoped-array.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class scoped_array {
}

void reset(T *array = NULL) {
MARISA_THROW_IF((array != NULL) && (array == array_), MARISA_RESET_ERROR);
MARISA_DEBUG_IF((array != NULL) && (array == array_), MARISA_RESET_ERROR);
scoped_array(array).swap(*this);
}

Expand Down
2 changes: 1 addition & 1 deletion include/marisa/scoped-ptr.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class scoped_ptr {
}

void reset(T *ptr = NULL) {
MARISA_THROW_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
MARISA_DEBUG_IF((ptr != NULL) && (ptr == ptr_), MARISA_RESET_ERROR);
scoped_ptr(ptr).swap(*this);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/marisa/grimoire/vector/bit-vector.cc
Original file line number Diff line number Diff line change
Expand Up @@ -782,7 +782,7 @@ void BitVector::build_index(const BitVector &bv,
const std::size_t unit_num_0s =
std::min<std::size_t>(bits_remaining, MARISA_WORD_SIZE) - unit_num_1s;

const std::size_t zero_bit_id = -num_0s % 512;
const std::size_t zero_bit_id = (~num_0s + 1) % 512;
if (unit_num_0s > zero_bit_id) {
// select0s_ is UInt32, but select_bit returns size_t, so cast to
// suppress narrowing conversion warning. push_back checks the
Expand All @@ -795,7 +795,7 @@ void BitVector::build_index(const BitVector &bv,
}

if (enables_select1) {
const std::size_t one_bit_id = -num_1s % 512;
const std::size_t one_bit_id = (~num_1s + 1) % 512;
if (unit_num_1s > one_bit_id) {
select1s_.push_back(
static_cast<UInt32>(select_bit(one_bit_id, bit_id, unit)));
Expand Down
2 changes: 1 addition & 1 deletion tools/Makefile.am
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
MY_INCLUDE = -I$(top_srcdir)/include -I$(top_srcdir)/lib
MY_INCLUDE = -I$(top_srcdir)/include
MY_LIBS = $(top_srcdir)/lib/marisa/libmarisa.la libcmdopt.la

AM_CXXFLAGS = -Wall -Weffc++ -Wextra -Wconversion $(MY_INCLUDE)
Expand Down
4 changes: 2 additions & 2 deletions vs2008/base-test/base-test.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -116,7 +116,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/io-test/io-test.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/libmarisa/libmarisa.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MARISA_EXPORTS"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -105,7 +105,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MARISA_EXPORTS"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/marisa-benchmark/marisa-benchmark.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/marisa-build/marisa-build.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/marisa-dump/marisa-dump.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/marisa-lookup/marisa-lookup.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/marisa-reverse-lookup/marisa-reverse-lookup.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/marisa-test/marisa-test.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/trie-test/trie-test.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
4 changes: 2 additions & 2 deletions vs2008/vector-test/vector-test.vcproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
<Tool
Name="VCCLCompilerTool"
Optimization="0"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;_DEBUG;_CONSOLE"
MinimalRebuild="true"
BasicRuntimeChecks="3"
Expand Down Expand Up @@ -115,7 +115,7 @@
Name="VCCLCompilerTool"
Optimization="2"
EnableIntrinsicFunctions="true"
AdditionalIncludeDirectories="../../lib"
AdditionalIncludeDirectories="../../lib;../../include"
PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="true"
Expand Down
Loading