Skip to content

Commit e2ef916

Browse files
committed
Avoid unused variable warnings
Signed-off-by: Juan Cruz Viotti <[email protected]>
1 parent 6cef045 commit e2ef916

File tree

48 files changed

+356
-354
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+356
-354
lines changed

DEPENDENCIES

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
vendorpull https://github.com/sourcemeta/vendorpull 1dcbac42809cf87cb5b045106b863e17ad84ba02
2-
core https://github.com/sourcemeta/core 31d3868e3f4217be3ed5de3b0ea31d521f1b873c
2+
core https://github.com/sourcemeta/core e4d7ae9358710fc138d2afd3179db6d850e4190f
33
bootstrap https://github.com/twbs/bootstrap 1a6fdfae6be09b09eaced8f0e442ca6f7680a61e

src/compiler/compiler.cc

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
#include "encoding.h"
88

9+
#include <cassert> // assert
10+
911
static auto
1012
transformer_callback_noop(const sourcemeta::core::Pointer &,
1113
const std::string_view, const std::string_view,
@@ -25,8 +27,10 @@ auto canonicalize(sourcemeta::core::JSON &schema,
2527
sourcemeta::core::SchemaTransformer canonicalizer;
2628
sourcemeta::core::add(canonicalizer,
2729
sourcemeta::core::AlterSchemaMode::Canonicalizer);
28-
canonicalizer.apply(schema, walker, make_resolver(resolver),
29-
transformer_callback_noop, default_dialect);
30+
[[maybe_unused]] const auto result =
31+
canonicalizer.apply(schema, walker, make_resolver(resolver),
32+
transformer_callback_noop, default_dialect);
33+
assert(result.first);
3034
}
3135

3236
auto make_encoding(sourcemeta::core::JSON &document,
@@ -83,8 +87,10 @@ auto compile(sourcemeta::core::JSON &schema,
8387
// Numbers
8488
mapper.add<NumberArbitrary>();
8589

86-
mapper.apply(schema, walker, make_resolver(resolver),
87-
transformer_callback_noop, default_dialect);
90+
[[maybe_unused]] const auto mapper_result =
91+
mapper.apply(schema, walker, make_resolver(resolver),
92+
transformer_callback_noop, default_dialect);
93+
assert(mapper_result.first);
8894

8995
// The "any" encoding is always the last resort
9096
const auto dialect{sourcemeta::core::dialect(schema)};

test/compiler/2020_12_canonicalizer_any_test.cc

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_1) {
6161
const auto expected = sourcemeta::core::parse_json(R"JSON({
6262
"$schema": "https://json-schema.org/draft/2020-12/schema",
6363
"anyOf": [
64-
{ "type": "number", "multipleOf": 1 },
64+
{ "type": "number" },
6565
{ "type": "string", "minLength": 0 }
6666
]
6767
})JSON");
@@ -85,7 +85,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_2) {
8585
const auto expected = sourcemeta::core::parse_json(R"JSON({
8686
"$schema": "https://json-schema.org/draft/2020-12/schema",
8787
"anyOf": [
88-
{ "type": "number", "multipleOf": 1 },
88+
{ "type": "number" },
8989
{ "type": "string", "minLength": 0 }
9090
]
9191
})JSON");
@@ -116,7 +116,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, duplicate_anyof_branches_3) {
116116
const auto expected = sourcemeta::core::parse_json(R"JSON({
117117
"$schema": "https://json-schema.org/draft/2020-12/schema",
118118
"anyOf": [
119-
{ "type": "number", "multipleOf": 1 },
119+
{ "type": "number" },
120120
{ "type": "string", "minLength": 0 }
121121
]
122122
})JSON");
@@ -245,12 +245,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, implicit_type_union_1) {
245245
"minLength": 0
246246
},
247247
{
248-
"type": "number",
249-
"multipleOf": 1
250-
},
251-
{
252-
"type": "integer",
253-
"multipleOf": 1
248+
"type": "number"
254249
}
255250
]
256251
})JSON");
@@ -284,12 +279,7 @@ TEST(JSONBinPack_Canonicalizer_Any_2020_12, boolean_schema_1) {
284279
"minLength": 0
285280
},
286281
{
287-
"type": "number",
288-
"multipleOf": 1
289-
},
290-
{
291-
"type": "integer",
292-
"multipleOf": 1
282+
"type": "number"
293283
}
294284
]
295285
})JSON");

test/compiler/2020_12_canonicalizer_number_test.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -495,7 +495,6 @@ TEST(JSONBinPack_Canonicalizer_Number_2020_12, drop_non_numeric_keywords_1) {
495495
const auto expected = sourcemeta::core::parse_json(R"JSON({
496496
"$schema": "https://json-schema.org/draft/2020-12/schema",
497497
"type": "number",
498-
"multipleOf": 1,
499498
"maximum": 4
500499
})JSON");
501500

test/compiler/2020_12_canonicalizer_object_test.cc

Lines changed: 17 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12,
2929
{ "type": "object", "minProperties": 0, "properties": {} },
3030
{ "type": "array", "minItems": 0 },
3131
{ "type": "string", "minLength": 0 },
32-
{ "type": "number", "multipleOf": 1 },
33-
{ "type": "integer", "multipleOf": 1 }
32+
{ "type": "number" }
3433
]
3534
},
3635
"bar": {
@@ -40,8 +39,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12,
4039
{ "type": "object", "minProperties": 0, "properties": {} },
4140
{ "type": "array", "minItems": 0 },
4241
{ "type": "string", "minLength": 0 },
43-
{ "type": "number", "multipleOf": 1 },
44-
{ "type": "integer", "multipleOf": 1 }
42+
{ "type": "number" }
4543
]
4644
}
4745
}
@@ -75,8 +73,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12,
7573
{ "type": "object", "minProperties": 0, "properties": {} },
7674
{ "type": "array", "minItems": 0 },
7775
{ "type": "string", "minLength": 0 },
78-
{ "type": "number", "multipleOf": 1 },
79-
{ "type": "integer", "multipleOf": 1 }
76+
{ "type": "number" }
8077
]
8178
},
8279
"bar": {
@@ -86,8 +83,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12,
8683
{ "type": "object", "minProperties": 0, "properties": {} },
8784
{ "type": "array", "minItems": 0 },
8885
{ "type": "string", "minLength": 0 },
89-
{ "type": "number", "multipleOf": 1 },
90-
{ "type": "integer", "multipleOf": 1 }
86+
{ "type": "number" }
9187
]
9288
}
9389
}
@@ -121,8 +117,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12,
121117
{ "type": "object", "minProperties": 0, "properties": {} },
122118
{ "type": "array", "minItems": 0 },
123119
{ "type": "string", "minLength": 0 },
124-
{ "type": "number", "multipleOf": 1 },
125-
{ "type": "integer", "multipleOf": 1 }
120+
{ "type": "number" }
126121
]
127122
},
128123
"foo": {
@@ -132,8 +127,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12,
132127
{ "type": "object", "minProperties": 0, "properties": {} },
133128
{ "type": "array", "minItems": 0 },
134129
{ "type": "string", "minLength": 0 },
135-
{ "type": "number", "multipleOf": 1 },
136-
{ "type": "integer", "multipleOf": 1 }
130+
{ "type": "number" }
137131
]
138132
}
139133
}
@@ -231,8 +225,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_1) {
231225
{ "type": "object", "minProperties": 0, "properties": {} },
232226
{ "type": "array", "minItems": 0 },
233227
{ "type": "string", "minLength": 0 },
234-
{ "type": "number", "multipleOf": 1 },
235-
{ "type": "integer", "multipleOf": 1 }
228+
{ "type": "number" }
236229
]
237230
},
238231
"bar": {
@@ -242,8 +235,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_1) {
242235
{ "type": "object", "minProperties": 0, "properties": {} },
243236
{ "type": "array", "minItems": 0 },
244237
{ "type": "string", "minLength": 0 },
245-
{ "type": "number", "multipleOf": 1 },
246-
{ "type": "integer", "multipleOf": 1 }
238+
{ "type": "number" }
247239
]
248240
},
249241
"baz": {
@@ -253,8 +245,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_1) {
253245
{ "type": "object", "minProperties": 0, "properties": {} },
254246
{ "type": "array", "minItems": 0 },
255247
{ "type": "string", "minLength": 0 },
256-
{ "type": "number", "multipleOf": 1 },
257-
{ "type": "integer", "multipleOf": 1 }
248+
{ "type": "number" }
258249
]
259250
}
260251
}
@@ -290,8 +281,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_2) {
290281
{ "type": "object", "minProperties": 0, "properties": {} },
291282
{ "type": "array", "minItems": 0 },
292283
{ "type": "string", "minLength": 0 },
293-
{ "type": "number", "multipleOf": 1 },
294-
{ "type": "integer", "multipleOf": 1 }
284+
{ "type": "number" }
295285
]
296286
},
297287
"baz": {
@@ -301,8 +291,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_2) {
301291
{ "type": "object", "minProperties": 0, "properties": {} },
302292
{ "type": "array", "minItems": 0 },
303293
{ "type": "string", "minLength": 0 },
304-
{ "type": "number", "multipleOf": 1 },
305-
{ "type": "integer", "multipleOf": 1 }
294+
{ "type": "number" }
306295
]
307296
},
308297
"foo": {
@@ -312,8 +301,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_2) {
312301
{ "type": "object", "minProperties": 0, "properties": {} },
313302
{ "type": "array", "minItems": 0 },
314303
{ "type": "string", "minLength": 0 },
315-
{ "type": "number", "multipleOf": 1 },
316-
{ "type": "integer", "multipleOf": 1 }
304+
{ "type": "number" }
317305
]
318306
},
319307
"qux": {
@@ -323,8 +311,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, dependent_required_tautology_2) {
323311
{ "type": "object", "minProperties": 0, "properties": {} },
324312
{ "type": "array", "minItems": 0 },
325313
{ "type": "string", "minLength": 0 },
326-
{ "type": "number", "multipleOf": 1 },
327-
{ "type": "integer", "multipleOf": 1 }
314+
{ "type": "number" }
328315
]
329316
}
330317
}
@@ -356,8 +343,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, duplicate_required_values_1) {
356343
{ "type": "object", "minProperties": 0, "properties": {} },
357344
{ "type": "array", "minItems": 0 },
358345
{ "type": "string", "minLength": 0 },
359-
{ "type": "number", "multipleOf": 1 },
360-
{ "type": "integer", "multipleOf": 1 }
346+
{ "type": "number" }
361347
]
362348
}
363349
}
@@ -389,8 +375,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, duplicate_required_values_2) {
389375
{ "type": "object", "minProperties": 0, "properties": {} },
390376
{ "type": "array", "minItems": 0 },
391377
{ "type": "string", "minLength": 0 },
392-
{ "type": "number", "multipleOf": 1 },
393-
{ "type": "integer", "multipleOf": 1 }
378+
{ "type": "number" }
394379
]
395380
},
396381
"baz": {
@@ -400,8 +385,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, duplicate_required_values_2) {
400385
{ "type": "object", "minProperties": 0, "properties": {} },
401386
{ "type": "array", "minItems": 0 },
402387
{ "type": "string", "minLength": 0 },
403-
{ "type": "number", "multipleOf": 1 },
404-
{ "type": "integer", "multipleOf": 1 }
388+
{ "type": "number" }
405389
]
406390
},
407391
"foo": {
@@ -411,8 +395,7 @@ TEST(JSONBinPack_Canonicalizer_Object_2020_12, duplicate_required_values_2) {
411395
{ "type": "object", "minProperties": 0, "properties": {} },
412396
{ "type": "array", "minItems": 0 },
413397
{ "type": "string", "minLength": 0 },
414-
{ "type": "number", "multipleOf": 1 },
415-
{ "type": "integer", "multipleOf": 1 }
398+
{ "type": "number" }
416399
]
417400
}
418401
}

test/e2e/circleciblank/schema-less/canonical.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
"minLength": 0
2121
},
2222
{
23-
"type": "number",
24-
"multipleOf": 1
25-
},
26-
{
27-
"type": "integer",
28-
"multipleOf": 1
23+
"type": "number"
2924
}
3025
]
3126
}

test/e2e/circlecimatrix/schema-less/canonical.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
"minLength": 0
2121
},
2222
{
23-
"type": "number",
24-
"multipleOf": 1
25-
},
26-
{
27-
"type": "integer",
28-
"multipleOf": 1
23+
"type": "number"
2924
}
3025
]
3126
}

test/e2e/commitlint/schema-less/canonical.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
"minLength": 0
2121
},
2222
{
23-
"type": "number",
24-
"multipleOf": 1
25-
},
26-
{
27-
"type": "integer",
28-
"multipleOf": 1
23+
"type": "number"
2924
}
3025
]
3126
}

test/e2e/commitlintbasic/schema-less/canonical.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
"minLength": 0
2121
},
2222
{
23-
"type": "number",
24-
"multipleOf": 1
25-
},
26-
{
27-
"type": "integer",
28-
"multipleOf": 1
23+
"type": "number"
2924
}
3025
]
3126
}

test/e2e/epr/schema-less/canonical.json

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,12 +20,7 @@
2020
"minLength": 0
2121
},
2222
{
23-
"type": "number",
24-
"multipleOf": 1
25-
},
26-
{
27-
"type": "integer",
28-
"multipleOf": 1
23+
"type": "number"
2924
}
3025
]
3126
}

0 commit comments

Comments
 (0)