Add VALIJSON_USE_EXCEPTIONS mode

This patch adds support for a new Cmake option,
VALIJSON_USE_EXCEPTIONS. If specified and set to `0`, Valijson will
disable all exception throwing, add the `-fno-exceptions` compiler flag,
and print to std::err and abort where exceptions would have been thrown.

NOTE: to set the value of a CMake option, the easiest way is to modify
the appropriate source line in the <build folder>/CMakeCache.txt file.

Bug: #106
This commit is contained in:
Jordan Bayles
2020-11-06 18:17:36 -08:00
parent a703886214
commit a30ef97465
30 changed files with 352 additions and 155 deletions

View File

@@ -36,7 +36,11 @@ TEST_F(TestValidationErrors, AllOfConstraintFailure)
// Parse schema document
Schema schema;
SchemaParser schemaParser;
ASSERT_NO_THROW( schemaParser.populateSchema(schemaAdapter, schema) );
#if VALIJSON_USE_EXCEPTIONS
ASSERT_NO_THROW(schemaParser.populateSchema(schemaAdapter, schema));
#else
schemaParser.populateSchema(schemaAdapter, schema);
#endif
// Load test document
rapidjson::Document testDocument;