Skip to content

Commit

Permalink
Guard export includes in every public header (#1303)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Oct 14, 2024
1 parent dcc7200 commit 1f8309e
Show file tree
Hide file tree
Showing 20 changed files with 40 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/evaluator/include/sourcemeta/jsontoolkit/evaluator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_EVALUATOR_H_
#define SOURCEMETA_JSONTOOLKIT_EVALUATOR_H_

#ifndef SOURCEMETA_JSONTOOLKIT_EVALUATOR_EXPORT
#include "evaluator_export.h"
#endif

#include <sourcemeta/jsontoolkit/evaluator_context.h>
#include <sourcemeta/jsontoolkit/evaluator_error.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_EVALUATOR_CONTEXT_H
#define SOURCEMETA_JSONTOOLKIT_EVALUATOR_CONTEXT_H

#ifndef SOURCEMETA_JSONTOOLKIT_EVALUATOR_EXPORT
#include "evaluator_export.h"
#endif

#include <sourcemeta/jsontoolkit/evaluator_template.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_EVALUATOR_ERROR_H
#define SOURCEMETA_JSONTOOLKIT_EVALUATOR_ERROR_H

#ifndef SOURCEMETA_JSONTOOLKIT_EVALUATOR_EXPORT
#include "evaluator_export.h"
#endif

#include <exception> // std::exception
#include <string> // std::string
Expand Down
2 changes: 2 additions & 0 deletions src/json/include/sourcemeta/jsontoolkit/json.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSON_H_
#define SOURCEMETA_JSONTOOLKIT_JSON_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSON_EXPORT
#include "json_export.h"
#endif

#include <sourcemeta/jsontoolkit/json_error.h>
#include <sourcemeta/jsontoolkit/json_value.h>
Expand Down
2 changes: 2 additions & 0 deletions src/json/include/sourcemeta/jsontoolkit/json_error.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSON_ERROR_H_
#define SOURCEMETA_JSONTOOLKIT_JSON_ERROR_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSON_EXPORT
#include "json_export.h"
#endif

#include <cstdint> // std::uint64_t
#include <exception> // std::exception
Expand Down
2 changes: 2 additions & 0 deletions src/json/include/sourcemeta/jsontoolkit/json_value.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSON_VALUE_H_
#define SOURCEMETA_JSONTOOLKIT_JSON_VALUE_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSON_EXPORT
#include "json_export.h"
#endif

#include <sourcemeta/jsontoolkit/json_array.h>
#include <sourcemeta/jsontoolkit/json_object.h>
Expand Down
2 changes: 2 additions & 0 deletions src/jsonl/include/sourcemeta/jsontoolkit/jsonl.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONL_H_
#define SOURCEMETA_JSONTOOLKIT_JSONL_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONL_EXPORT
#include "jsonl_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonl_iterator.h>
Expand Down
2 changes: 2 additions & 0 deletions src/jsonl/include/sourcemeta/jsontoolkit/jsonl_iterator.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONL_ITERATOR_H_
#define SOURCEMETA_JSONTOOLKIT_JSONL_ITERATOR_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONL_EXPORT
#include "jsonl_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>

Expand Down
2 changes: 2 additions & 0 deletions src/jsonpointer/include/sourcemeta/jsontoolkit/jsonpointer.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONPOINTER_H_
#define SOURCEMETA_JSONTOOLKIT_JSONPOINTER_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONPOINTER_EXPORT
#include "jsonpointer_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonpointer.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONPOINTER_ERROR_H_
#define SOURCEMETA_JSONTOOLKIT_JSONPOINTER_ERROR_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONPOINTER_EXPORT
#include "jsonpointer_export.h"
#endif

#include <sourcemeta/jsontoolkit/json_error.h>

Expand Down
2 changes: 2 additions & 0 deletions src/jsonschema/include/sourcemeta/jsontoolkit/jsonschema.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonschema_anchor.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_ANCHOR_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_ANCHOR_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonschema_resolver.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_BUNDLE_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_BUNDLE_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonschema_resolver.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_COMPILE_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_COMPILE_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/evaluator.h>
#include <sourcemeta/jsontoolkit/jsonschema_reference.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_ERROR_H
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_ERROR_H

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/jsonpointer.h>
#include <sourcemeta/jsontoolkit/uri.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_REFERENCE_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_REFERENCE_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/jsonpointer.h>
#include <sourcemeta/jsontoolkit/jsonschema_resolver.h>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_RESOLVER_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_RESOLVER_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_WALKER_H_
#define SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_WALKER_H_

#ifndef SOURCEMETA_JSONTOOLKIT_JSONSCHEMA_EXPORT
#include "jsonschema_export.h"
#endif

#include <sourcemeta/jsontoolkit/json.h>
#include <sourcemeta/jsontoolkit/jsonpointer.h>
Expand Down
2 changes: 2 additions & 0 deletions src/uri/include/sourcemeta/jsontoolkit/uri.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_URI_H_
#define SOURCEMETA_JSONTOOLKIT_URI_H_

#ifndef SOURCEMETA_JSONTOOLKIT_URI_EXPORT
#include "uri_export.h"
#endif

#include <sourcemeta/jsontoolkit/uri_error.h>

Expand Down
2 changes: 2 additions & 0 deletions src/uri/include/sourcemeta/jsontoolkit/uri_error.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
#ifndef SOURCEMETA_JSONTOOLKIT_URI_ERROR_H_
#define SOURCEMETA_JSONTOOLKIT_URI_ERROR_H_

#ifndef SOURCEMETA_JSONTOOLKIT_URI_EXPORT
#include "uri_export.h"
#endif

#include <cstdint> // std::uint64_t
#include <exception> // std::exception
Expand Down

4 comments on commit 1f8309e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (macos/llvm)

Benchmark suite Current: 1f8309e Previous: dcc7200 Ratio
JSON_Array_Of_Objects_Unique 3744.347395492898 ns/iter 3524.4735654568276 ns/iter 1.06
Compiler_Draft6_AdaptiveCard 4385005874.999933 ns/iter 2950641499.9999604 ns/iter 1.49
Evaluator_Draft4_Meta_1_No_Callback 815.4006179948369 ns/iter 765.858422591543 ns/iter 1.06
Evaluator_Draft4_Required_Properties 1020.2027507430499 ns/iter 933.4179259934622 ns/iter 1.09
Evaluator_Draft4_Many_Optional_Properties_Minimal_Match 163.2750773378874 ns/iter 152.11738412611282 ns/iter 1.07
Evaluator_Draft4_Few_Optional_Properties_Minimal_Match 129.62172458496516 ns/iter 104.03532234549847 ns/iter 1.25
Evaluator_Draft4_Items_Schema 2857.514006019123 ns/iter 2637.8712793300565 ns/iter 1.08
Evaluator_Draft4_Nested_Object 27.576311768757492 ns/iter 23.52449118359853 ns/iter 1.17
Evaluator_Draft4_Properties_Triad_Optional 1397.249282524177 ns/iter 1315.9646994450834 ns/iter 1.06
Evaluator_Draft4_Properties_Triad_Closed 1012.4670168982035 ns/iter 975.1195987456857 ns/iter 1.04
Evaluator_Draft4_Properties_Triad_Required 1337.7267537045823 ns/iter 1348.3031815452437 ns/iter 0.99
Evaluator_Draft4_Non_Recursive_Ref 227.36815983058673 ns/iter 212.59035981158456 ns/iter 1.07
Evaluator_Draft4_Pattern_Properties_True 1420.3377892113526 ns/iter 1353.841369304453 ns/iter 1.05
Evaluator_Draft4_Ref_To_Single_Property 108.02501573849497 ns/iter 106.56729954044972 ns/iter 1.01
Evaluator_Draft4_Additional_Properties_Type 412.77045836785663 ns/iter 404.5404972901826 ns/iter 1.02
Evaluator_Draft4_Nested_Oneof 372.34261879019726 ns/iter 367.9497753030654 ns/iter 1.01
Evaluator_Draft6_Property_Names 782.7082091811931 ns/iter 783.5318242188841 ns/iter 1.00
Evaluator_Draft7_If_Then_Else 169.62069197717125 ns/iter 178.17315395495953 ns/iter 0.95
Evaluator_2020_12_Dynamic_Ref 2914.6049452280754 ns/iter 2954.559862047694 ns/iter 0.99

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/llvm)

Benchmark suite Current: 1f8309e Previous: dcc7200 Ratio
JSON_Array_Of_Objects_Unique 1873.4954375670584 ns/iter 1870.3187277091042 ns/iter 1.00
Compiler_Draft6_AdaptiveCard 5107689445.999995 ns/iter 5186515953.999958 ns/iter 0.98
Evaluator_Draft4_Meta_1_No_Callback 1012.2152481013884 ns/iter 982.9305306710622 ns/iter 1.03
Evaluator_Draft4_Required_Properties 1625.179368296952 ns/iter 1626.874154938542 ns/iter 1.00
Evaluator_Draft4_Many_Optional_Properties_Minimal_Match 190.43118412165697 ns/iter 188.90183361154433 ns/iter 1.01
Evaluator_Draft4_Few_Optional_Properties_Minimal_Match 125.09706178396166 ns/iter 124.11070953940852 ns/iter 1.01
Evaluator_Draft4_Items_Schema 3699.794215534958 ns/iter 3734.323508213844 ns/iter 0.99
Evaluator_Draft4_Nested_Object 32.33934622992502 ns/iter 32.051981160396984 ns/iter 1.01
Evaluator_Draft4_Properties_Triad_Optional 1721.5405208586858 ns/iter 1725.079881098483 ns/iter 1.00
Evaluator_Draft4_Properties_Triad_Closed 1430.9629674229725 ns/iter 1460.0907509554736 ns/iter 0.98
Evaluator_Draft4_Properties_Triad_Required 1817.292393644624 ns/iter 1805.164813363267 ns/iter 1.01
Evaluator_Draft4_Non_Recursive_Ref 472.9279191717693 ns/iter 472.24295487525006 ns/iter 1.00
Evaluator_Draft4_Pattern_Properties_True 2366.944712178007 ns/iter 2382.4437858418373 ns/iter 0.99
Evaluator_Draft4_Ref_To_Single_Property 127.83822949345632 ns/iter 125.60483243409766 ns/iter 1.02
Evaluator_Draft4_Additional_Properties_Type 578.772668286691 ns/iter 577.3783992926237 ns/iter 1.00
Evaluator_Draft4_Nested_Oneof 497.71614926726363 ns/iter 494.0700344479851 ns/iter 1.01
Evaluator_Draft6_Property_Names 1222.196027661447 ns/iter 1246.488919452931 ns/iter 0.98
Evaluator_Draft7_If_Then_Else 211.21854625905326 ns/iter 209.88590917471367 ns/iter 1.01
Evaluator_2020_12_Dynamic_Ref 3268.740835536221 ns/iter 3264.719156667398 ns/iter 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (linux/gcc)

Benchmark suite Current: 1f8309e Previous: dcc7200 Ratio
Evaluator_2020_12_Dynamic_Ref 3794.591816561471 ns/iter 3813.918160527042 ns/iter 0.99
Evaluator_Draft7_If_Then_Else 204.84167236091218 ns/iter 215.30053465184264 ns/iter 0.95
Evaluator_Draft6_Property_Names 1293.8806476739705 ns/iter 1311.9087204335399 ns/iter 0.99
Evaluator_Draft4_Meta_1_No_Callback 968.5442046145163 ns/iter 945.82798259592 ns/iter 1.02
Evaluator_Draft4_Required_Properties 1662.1132868027546 ns/iter 1669.8251505216874 ns/iter 1.00
Evaluator_Draft4_Many_Optional_Properties_Minimal_Match 180.10822533018055 ns/iter 180.46260271649817 ns/iter 1.00
Evaluator_Draft4_Few_Optional_Properties_Minimal_Match 124.43336005728378 ns/iter 126.92111782939567 ns/iter 0.98
Evaluator_Draft4_Items_Schema 3484.056714601152 ns/iter 3531.3848283690627 ns/iter 0.99
Evaluator_Draft4_Nested_Object 24.084384256116994 ns/iter 27.757603041599932 ns/iter 0.87
Evaluator_Draft4_Properties_Triad_Optional 1727.5318052520101 ns/iter 1730.377135983718 ns/iter 1.00
Evaluator_Draft4_Properties_Triad_Closed 1450.3111697556135 ns/iter 1459.1538176267588 ns/iter 0.99
Evaluator_Draft4_Properties_Triad_Required 1820.3952701634917 ns/iter 1810.940010791519 ns/iter 1.01
Evaluator_Draft4_Non_Recursive_Ref 534.673307304226 ns/iter 516.5998498299572 ns/iter 1.03
Evaluator_Draft4_Pattern_Properties_True 2203.094539102342 ns/iter 2239.14848597188 ns/iter 0.98
Evaluator_Draft4_Ref_To_Single_Property 126.28679745819171 ns/iter 132.23776512464767 ns/iter 0.95
Evaluator_Draft4_Additional_Properties_Type 587.6713833803865 ns/iter 574.8973504880565 ns/iter 1.02
Evaluator_Draft4_Nested_Oneof 456.458500491918 ns/iter 459.92714274346577 ns/iter 0.99
Compiler_Draft6_AdaptiveCard 5223344337.000072 ns/iter 5213529884.999957 ns/iter 1.00
JSON_Array_Of_Objects_Unique 1897.4765755708975 ns/iter 1894.2779221562707 ns/iter 1.00

This comment was automatically generated by workflow using github-action-benchmark.

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Benchmark (windows/msvc)

Benchmark suite Current: 1f8309e Previous: dcc7200 Ratio
JSON_Array_Of_Objects_Unique 4861.711505991998 ns/iter 4851.144509950205 ns/iter 1.00
Compiler_Draft6_AdaptiveCard 10051556799.999958 ns/iter 9829075999.999872 ns/iter 1.02
Evaluator_Draft4_Meta_1_No_Callback 2345.2105522206302 ns/iter 2278.5999122771536 ns/iter 1.03
Evaluator_Draft4_Required_Properties 1998.5343063999278 ns/iter 1982.156319370807 ns/iter 1.01
Evaluator_Draft4_Many_Optional_Properties_Minimal_Match 560.6835714285045 ns/iter 556.315799999993 ns/iter 1.01
Evaluator_Draft4_Few_Optional_Properties_Minimal_Match 414.50335649538425 ns/iter 414.4451466764968 ns/iter 1.00
Evaluator_Draft4_Items_Schema 6375.81339285731 ns/iter 6366.958035714885 ns/iter 1.00
Evaluator_Draft4_Nested_Object 158.41486607140862 ns/iter 161.30069196432623 ns/iter 0.98
Evaluator_Draft4_Properties_Triad_Optional 5598.872000000483 ns/iter 5335.67800000128 ns/iter 1.05
Evaluator_Draft4_Properties_Triad_Closed 4420.274075464988 ns/iter 4405.119657178959 ns/iter 1.00
Evaluator_Draft4_Properties_Triad_Required 5415.6430000000455 ns/iter 5441.696000000319 ns/iter 1.00
Evaluator_Draft4_Non_Recursive_Ref 560.8776785713587 ns/iter 562.8154999999424 ns/iter 1.00
Evaluator_Draft4_Pattern_Properties_True 8050.046875000153 ns/iter 8018.22625791916 ns/iter 1.00
Evaluator_Draft4_Ref_To_Single_Property 420.88932469249573 ns/iter 422.3572691182775 ns/iter 1.00
Evaluator_Draft4_Additional_Properties_Type 805.9635687661616 ns/iter 793.59866071422 ns/iter 1.02
Evaluator_Draft4_Nested_Oneof 1093.8273437499647 ns/iter 1091.9509375000302 ns/iter 1.00
Evaluator_Draft6_Property_Names 1825.547969239112 ns/iter 1817.1091626499074 ns/iter 1.00
Evaluator_Draft7_If_Then_Else 549.6598999999378 ns/iter 553.9108000000397 ns/iter 0.99
Evaluator_2020_12_Dynamic_Ref 8747.780143839998 ns/iter 8876.332589284886 ns/iter 0.99

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.