diff --git a/.editorconfig b/.editorconfig index 5c2baf6..9035bef 100644 --- a/.editorconfig +++ b/.editorconfig @@ -8,5 +8,5 @@ indent_style = space insert_final_newline = true trim_trailing_whitespace = true -[*.{h,hh,hpp,c,cc,cpp,cxx}] +[*.{h,hh,hpp,c,cc,cpp,cxx,yml}] indent_size = 2 diff --git a/CMakeLists.txt b/CMakeLists.txt index 634dfc4..70f723f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -25,10 +25,17 @@ file(GLOB_RECURSE MADDY_TESTS_FILES ${CMAKE_CURRENT_SOURCE_DIR}/tests/maddy/*.cp # ------------------------------------------------------------------------------ -set( - CMAKE_CXX_FLAGS - "${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer" -) +if (UNIX) + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -g -std=c++${MADDY_CPP_VERSION} -Wall -Wpedantic -Wextra -Wno-ignored-qualifiers -fno-rtti -fno-exceptions -fsanitize=address -fno-omit-frame-pointer" + ) +else() + set( + CMAKE_CXX_FLAGS + "${CMAKE_CXX_FLAGS} -std=c++${MADDY_CPP_VERSION}" + ) +endif() # ------------------------------------------------------------------------------ diff --git a/appveyor.yml b/appveyor.yml new file mode 100644 index 0000000..e8842c3 --- /dev/null +++ b/appveyor.yml @@ -0,0 +1,15 @@ +image: Visual Studio 2017 + +install: + - cmd: git submodule update --init --recursive + +before_build: + - cmd: mkdir tmp + - cmd: cd tmp + - cmd: cmake -G "Visual Studio 15 Win64" .. + +build: + project: $(APPVEYOR_BUILD_FOLDER)\tmp\$(APPVEYOR_PROJECT_NAME).sln + +test_script: + - cmd: ctest -VV -C "Debug" diff --git a/include/maddy/blockparser.h b/include/maddy/blockparser.h index 5aeed5f..9df4fa6 100644 --- a/include/maddy/blockparser.h +++ b/include/maddy/blockparser.h @@ -157,24 +157,26 @@ protected: { bool hasMetNonSpace = false; - uint32_t indentation = std::count_if( - line.begin(), - line.end(), - [&hasMetNonSpace](unsigned char c) - { - if (hasMetNonSpace) + uint32_t indentation = static_cast( + std::count_if( + line.begin(), + line.end(), + [&hasMetNonSpace](unsigned char c) { + if (hasMetNonSpace) + { + return false; + } + + if (std::isspace(c)) + { + return true; + } + + hasMetNonSpace = true; return false; } - - if (std::isspace(c)) - { - return true; - } - - hasMetNonSpace = true; - return false; - } + ) ); return indentation;