diff --git a/CMakeLists.txt b/CMakeLists.txt index dd1fe45..c55d936 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -31,9 +31,12 @@ target_include_directories(json-schema-validator target_compile_features(json-schema-validator PUBLIC cxx_range_for) # for C++11 - flags -target_compile_options(json-schema-validator +# Enable more compiler warnings, except when using Visual Studio compiler +if(NOT MSVC) + target_compile_options(json-schema-validator PUBLIC - -Wall) # bad, better use something else based on compiler type + -Wall -Wextra) +endif() target_link_libraries(json-schema-validator PUBLIC json-hpp) diff --git a/app/json-schema-validate.cpp b/app/json-schema-validate.cpp index 7045faf..1cfb9af 100644 --- a/app/json-schema-validate.cpp +++ b/app/json-schema-validate.cpp @@ -93,7 +93,7 @@ int main(int argc, char *argv[]) json document; try { - document << std::cin; + std::cin >> document; validator.validate(document); } catch (std::exception &e) { std::cerr << "schema validation failed\n"; diff --git a/src/json-validator.cpp b/src/json-validator.cpp index 811b772..ca04e0b 100644 --- a/src/json-validator.cpp +++ b/src/json-validator.cpp @@ -344,7 +344,7 @@ void json_validator::validate(const json &instance, const json &schema_, const s try { validate(instance, attr.value(), name); ok = false; - } catch (std::exception &e) { + } catch (std::exception &) { ok = true; } if (!ok)