Compile clean with -Werror

This commit is contained in:
Jonathan Müller 2017-04-24 10:09:49 +02:00
commit 63c34e1ca3
4 changed files with 9 additions and 5 deletions

View file

@ -57,6 +57,6 @@ install:
script:
- mkdir build/ && cd build/
- $CMAKE -DCMAKE_CXX_FLAGS="-pedantic -Wall -Wextra -Wconversion -Wsign-conversion -Wno-parentheses" -DLLVM_DOWNLOAD_OS_NAME=$LLVM_DOWNLOAD_OS_NAME -DLLVM_PREFERRED_VERSION=$LLVM_VERSION ../
- $CMAKE -DCMAKE_CXX_FLAGS="-Werror -pedantic -Wall -Wextra -Wconversion -Wsign-conversion -Wno-parentheses" -DLLVM_DOWNLOAD_OS_NAME=$LLVM_DOWNLOAD_OS_NAME -DLLVM_PREFERRED_VERSION=$LLVM_VERSION ../
- $CMAKE --build .
- ./test/cppast_test

@ -1 +1 @@
Subproject commit 7539bc3f0c23104accc09f5c024d6b3609f0debe
Subproject commit 50f69197c2af03dc93cd0985a39d6809c80a27b5

View file

@ -30,7 +30,11 @@ namespace
{
unsigned offset;
clang_getSpellingLocation(loc, nullptr, nullptr, nullptr, &offset);
return clang_getLocationForOffset(tu, file, offset + inc);
if (inc >= 0)
offset += unsigned(inc);
else
offset -= unsigned(-inc);
return clang_getLocationForOffset(tu, file, offset);
}
class simple_tokenizer
@ -312,7 +316,7 @@ detail::token_iterator detail::find_closing_bracket(detail::token_stream stream)
--bracket_count;
else if (paren_count == 0 && template_bracket && cur == ">>")
// maximal munch
bracket_count -= 2u;
bracket_count -= 2;
else if (cur == "(" || cur == "{" || cur == "[")
++paren_count;
else if (cur == ")" || cur == "}" || cur == "]")

View file

@ -288,7 +288,7 @@ int main(int argc, char* argv[])
logger.set_verbose(true);
auto file = parse_file(config, logger, options["file"].as<std::string>(),
options.count("fatal_errors") == 1u);
options.count("fatal_errors") == 1);
if (!file)
return 2;
print_ast(std::cout, *file);