Fix two warnings on raised by Visual Studio 2015 compiler + disable -Wall and -Wextra when using Visual Studio compiler

This commit is contained in:
Gert Van Hoey 2017-08-07 10:57:52 +02:00
parent 5bf860315e
commit a23f87ee35
3 changed files with 7 additions and 4 deletions

View File

@ -31,9 +31,12 @@ target_include_directories(json-schema-validator
target_compile_features(json-schema-validator
PUBLIC
cxx_range_for) # for C++11 - flags
# 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)

View File

@ -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";

View File

@ -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)