Skip to content

Commit 1a615a7

Browse files
authored
CDRIVER-5866 Use consistent syntax for include directives (#1840)
* Consistently use library directory prefix * Consistently use <> syntax for bson, mongoc, and common headers * Avoid extra trailing newlines in generated sources
1 parent 45cf893 commit 1a615a7

File tree

430 files changed

+1826
-1836
lines changed

Some content is hidden

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

430 files changed

+1826
-1836
lines changed

.evergreen/scripts/check-preludes.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
MONGOC_PREFIX / "mongoc-prelude.h",
3636
MONGOC_PREFIX / "mongoc.h",
3737
],
38-
"include": '#include "mongoc-prelude.h"',
38+
"include": '#include <mongoc/mongoc-prelude.h>',
3939
},
4040
{
4141
"name": "libbson",
@@ -50,7 +50,7 @@
5050
"name": "common",
5151
"headers": list(COMMON_PREFIX.glob("*.h")),
5252
"exclusions": [COMMON_PREFIX / "common-prelude.h"],
53-
"include": '#include "common-prelude.h"',
53+
"include": '#include <common-prelude.h>',
5454
},
5555
]
5656

build/future_function_templates/future-functions.c.template

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@
1414
* controlling the server from the main thread.
1515
*/
1616

17-
#include "mongoc/mongoc-topology-private.h"
17+
#include <mongoc/mongoc-topology-private.h>
1818

19-
#include "future-functions.h"
19+
#include "mock_server/future-functions.h"
2020

2121
{% for F in future_functions %}
2222
static
@@ -41,8 +41,8 @@ BSON_THREAD_FUN (background_{{ F.name }}, data)
4141
BSON_THREAD_RETURN;
4242
}
4343
{% endfor %}
44-
4544
{% for F in future_functions %}
45+
4646
future_t *
4747
{{ F|future_function_name }} ({% for P in F.params %}
4848
{{ P.type_name }} {{ P.name }}{% if not loop.last %},{% endif %}{% endfor %})
@@ -56,5 +56,4 @@ future_t *
5656
future_start (future, background_{{ F.name }});
5757
return future;
5858
}
59-
{% endfor %}
60-
59+
{%- endfor %}

build/future_function_templates/future-functions.h.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
#ifndef FUTURE_FUNCTIONS_H
22
#define FUTURE_FUNCTIONS_H
33

4-
#include "future-value.h"
5-
#include "future.h"
6-
#include "mongoc/mongoc-bulk-operation.h"
4+
#include "mock_server/future-value.h"
5+
#include "mock_server/future.h"
6+
#include <mongoc/mongoc-bulk-operation.h>
77

88
{{ header_comment }}
99

build/future_function_templates/future-value.c.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "future-value.h"
1+
#include "mock_server/future-value.h"
22

33
{{ header_comment }}
44

@@ -19,8 +19,8 @@ future_value_get_void (future_value_t *future_value)
1919
{
2020
BSON_ASSERT (future_value->type == future_value_void_type);
2121
}
22-
2322
{% for T in type_list %}
23+
2424
void
2525
future_value_set_{{ T }} (future_value_t *future_value, {{ T }} value)
2626
{
@@ -34,4 +34,4 @@ future_value_get_{{ T }} (future_value_t *future_value)
3434
BSON_ASSERT (future_value->type == future_value_{{ T }}_type);
3535
return future_value->value.{{ T }}_value;
3636
}
37-
{% endfor %}
37+
{%- endfor %}

build/future_function_templates/future-value.h.template

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
#include <mongoc/mongoc.h>
55

66

7-
#include "mongoc/mongoc-cluster-private.h"
8-
#include "mongoc/mongoc-topology-private.h"
7+
#include <mongoc/mongoc-cluster-private.h>
8+
#include <mongoc/mongoc-topology-private.h>
99

1010

1111
{{ header_comment }}

build/future_function_templates/future.c.template

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
#include <stdio.h>
22

3-
#include "mongoc/mongoc-array-private.h"
4-
#include "mongoc/mongoc-thread-private.h"
5-
#include "future.h"
3+
#include <mongoc/mongoc-array-private.h>
4+
#include <mongoc/mongoc-thread-private.h>
5+
#include "mock_server/future.h"
66
#include "../test-libmongoc.h"
77

88
{{ header_comment }}

build/future_function_templates/future.h.template

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33

44
#include <bson/bson.h>
55

6-
#include "future-value.h"
7-
#include "mongoc/mongoc-thread-private.h"
6+
#include "mock_server/future-value.h"
7+
#include <mongoc/mongoc-thread-private.h>
88

99
{{ header_comment }}
1010

@@ -42,4 +42,3 @@ future_get_{{ T }} (future_t *future);
4242
void future_destroy (future_t *future);
4343

4444
#endif /* FUTURE_H */
45-

build/opts_templates/mongoc-opts-private.h.template

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,16 +14,16 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "mongoc-prelude.h"
17+
#include <mongoc/mongoc-prelude.h>
1818

1919
#ifndef MONGOC_OPTS_H
2020
#define MONGOC_OPTS_H
2121

2222
#include <bson/bson.h>
2323

24-
#include "mongoc-client-session.h"
25-
#include "mongoc-bulk-operation-private.h"
26-
#include "mongoc-opts-helpers-private.h"
24+
#include <mongoc/mongoc-client-session.h>
25+
#include <mongoc/mongoc-bulk-operation-private.h>
26+
#include <mongoc/mongoc-opts-helpers-private.h>
2727

2828
{{ header_comment }}
2929

build/opts_templates/mongoc-opts.c.template

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#include "mongoc-opts-helpers-private.h"
2-
#include "mongoc-opts-private.h"
3-
#include "mongoc-error.h"
4-
#include "mongoc-util-private.h"
5-
#include "mongoc-client-private.h"
1+
#include <mongoc/mongoc-opts-helpers-private.h>
2+
#include <mongoc/mongoc-opts-private.h>
3+
#include <mongoc/mongoc-error.h>
4+
#include <mongoc/mongoc-util-private.h>
5+
#include <mongoc/mongoc-client-private.h>
66

77
{{ header_comment }}
88
{% for struct_type, description in opts_structs.items() %}

src/common/src/common-atomic-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919

2020
#ifndef MONGO_C_DRIVER_COMMON_ATOMIC_PRIVATE_H

src/common/src/common-b64-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_B64_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_B64_PRIVATE_H

src/common/src/common-b64.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,8 +40,8 @@
4040
* IF IBM IS APPRISED OF THE POSSIBILITY OF SUCH DAMAGES.
4141
*/
4242

43-
#include "bson/bson.h"
44-
#include "common-b64-private.h"
43+
#include <bson/bson.h>
44+
#include <common-b64-private.h>
4545

4646
#define Assert(Cond) \
4747
if (!(Cond)) \

src/common/src/common-bits-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_BITS_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_BITS_PRIVATE_H

src/common/src/common-bson-dsl-private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#include "common-prelude.h"
1+
#include <common-prelude.h>
22

33
#ifndef MONGO_C_DRIVER_COMMON_BSON_DSL_PRIVATE_H
44
#define MONGO_C_DRIVER_COMMON_BSON_DSL_PRIVATE_H
@@ -13,7 +13,7 @@
1313
* For more information about using this DSL, refer to `bson-dsl.md`.
1414
*/
1515

16-
#include "bson/bson.h"
16+
#include <bson/bson.h>
1717
#include <common-cmp-private.h>
1818

1919
enum {

src/common/src/common-cmp-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_CMP_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_CMP_PRIVATE_H

src/common/src/common-json-private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_JSON_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_JSON_PRIVATE_H
2121

22-
#include "common-string-private.h"
22+
#include <common-string-private.h>
2323

2424
#define mcommon_iso8601_string_append COMMON_NAME (iso8601_string_append)
2525
#define mcommon_json_append_escaped COMMON_NAME (json_append_escaped)

src/common/src/common-macros-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_MACROS_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_MACROS_PRIVATE_H

src/common/src/common-md5-private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_MD5_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_MD5_PRIVATE_H
2121

22-
#include "bson/bson.h"
22+
#include <bson/bson.h>
2323

2424
BSON_BEGIN_DECLS
2525

src/common/src/common-md5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858

5959
#include <string.h>
6060

61-
#include "common-md5-private.h"
61+
#include <common-md5-private.h>
6262

6363
#undef BYTE_ORDER /* 1 = big-endian, -1 = little-endian, 0 = unknown */
6464
#if BSON_BYTE_ORDER == BSON_BIG_ENDIAN

src/common/src/common-oid-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_OID_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_OID_PRIVATE_H

src/common/src/common-string-private.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,14 +14,14 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_STRING_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_STRING_PRIVATE_H
2121

2222
#include <bson/bson.h>
2323
#include <string.h>
24-
#include "common-cmp-private.h"
24+
#include <common-cmp-private.h>
2525

2626

2727
/* Until the deprecated bson_string_t is removed, this must have the same members in the same order, so we can safely

src/common/src/common-string.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-string-private.h"
18-
#include "common-bits-private.h"
19-
#include "common-utf8-private.h"
20-
#include "common-b64-private.h"
21-
#include "common-cmp-private.h"
17+
#include <common-string-private.h>
18+
#include <common-bits-private.h>
19+
#include <common-utf8-private.h>
20+
#include <common-b64-private.h>
21+
#include <common-cmp-private.h>
2222

2323

2424
mcommon_string_t *

src/common/src/common-thread-private.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,17 +14,17 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
18-
#include "common-config.h"
19-
#include "common-macros-private.h"
17+
#include <common-prelude.h>
18+
#include <common-config.h>
19+
#include <common-macros-private.h>
2020

2121
#ifndef MONGO_C_DRIVER_COMMON_THREAD_PRIVATE_H
2222
#define MONGO_C_DRIVER_COMMON_THREAD_PRIVATE_H
2323

2424
#define BSON_INSIDE
25-
#include "bson/bson-compat.h"
26-
#include "bson/bson-config.h"
27-
#include "bson/bson-macros.h"
25+
#include <bson/bson-compat.h>
26+
#include <bson/bson-config.h>
27+
#include <bson/bson-macros.h>
2828
#undef BSON_INSIDE
2929

3030
BSON_BEGIN_DECLS

src/common/src/common-thread.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-thread-private.h"
17+
#include <common-thread-private.h>
1818

1919
#include <errno.h>
2020

src/common/src/common-utf8-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
* limitations under the License.
1515
*/
1616

17-
#include "common-prelude.h"
17+
#include <common-prelude.h>
1818

1919
#ifndef MONGO_C_DRIVER_COMMON_UTF8_PRIVATE_H
2020
#define MONGO_C_DRIVER_COMMON_UTF8_PRIVATE_H

src/libbson/src/bson/bcon.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
#include <stdio.h>
2323

24-
#include "bcon.h"
24+
#include <bson/bcon.h>
2525
#include <bson/bson-config.h>
2626

2727
/* These stack manipulation macros are used to manage append recursion in

src/libbson/src/bson/bcon.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
#ifndef BCON_H_
2424
#define BCON_H_
2525

26-
#include "bson.h"
26+
#include <bson/bson.h>
2727

2828

2929
BSON_BEGIN_DECLS

src/libbson/src/bson/bson-context-private.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323

2424
#include <bson/bson-context.h>
25-
#include "common-thread-private.h"
25+
#include <common-thread-private.h>
2626

2727

2828
BSON_BEGIN_DECLS

src/libbson/src/bson/bson-context.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include <bson/bson-context.h>
2828
#include <bson/bson-context-private.h>
2929
#include <bson/bson-memory.h>
30-
#include "common-thread-private.h"
30+
#include <common-thread-private.h>
3131

3232

3333
#ifndef HOST_NAME_MAX

src/libbson/src/bson/bson-iter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#define BSON_ITER_H
2222

2323

24-
#include "bson.h"
24+
#include <bson/bson.h>
2525
#include <bson/bson-endian.h>
2626
#include <bson/bson-macros.h>
2727
#include <bson/bson-types.h>

0 commit comments

Comments
 (0)