Skip to content

Commit 32a33a1

Browse files
authored
Fix include order in our standard headers. NFC (#26434)
This change was generated using: ``` clang-tidy -checks='llvm-include-order' -fix-errors -fix system/include/emscripten/*.h -- -x c++-header -std=c++17 --sysroot=cache/sysroot --target=wasm32-emscripten -iwithsysroot/include/compat ``` This change initially resulted in the failure of `test_em_js_bool_macro_expansion` which required that addition of `stdbool.h` to `em_js.h`.
1 parent cc9fb50 commit 32a33a1

19 files changed

Lines changed: 70 additions & 61 deletions

system/include/emscripten/atomic.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77

88
#pragma once
99

10-
#include <inttypes.h>
11-
1210
#include <emscripten/em_types.h>
1311

12+
#include <inttypes.h>
13+
1414
#ifdef __cplusplus
1515
extern "C" {
1616
#endif

system/include/emscripten/bind.h

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -11,18 +11,18 @@
1111
#error "embind requires -std=c++17 or newer"
1212
#endif
1313

14+
#include <emscripten/em_asm.h>
15+
#include <emscripten/val.h>
16+
#include <emscripten/wire.h>
17+
1418
#include <cassert>
1519
#include <cstddef>
1620
#include <functional>
1721
#include <map>
22+
#include <optional>
1823
#include <string>
1924
#include <type_traits>
2025
#include <vector>
21-
#include <optional>
22-
23-
#include <emscripten/em_asm.h>
24-
#include <emscripten/val.h>
25-
#include <emscripten/wire.h>
2626

2727
#if __has_feature(leak_sanitizer) || __has_feature(address_sanitizer)
2828
#include <sanitizer/lsan_interface.h>
@@ -434,7 +434,7 @@ template<typename ReturnType, typename... Args, typename... Policies>
434434
void function(const char* name, ReturnType (*fn)(Args...), Policies...) {
435435
using namespace internal;
436436
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, Args...> args;
437-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
437+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
438438
auto invoke = Invoker<ReturnPolicy, ReturnType, Args...>::invoke;
439439
_embind_register_function(
440440
name,
@@ -1295,7 +1295,7 @@ struct RegisterClassMethod<ReturnType (ClassType::*)(Args...)> {
12951295
template <typename CT, typename... Policies>
12961296
static void invoke(const char* methodName,
12971297
ReturnType (ClassType::*memberFunction)(Args...)) {
1298-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
1298+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
12991299
auto invoke = MethodInvoker<ReturnPolicy, decltype(memberFunction), ReturnType, ClassType*, Args...>::invoke;
13001300

13011301
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, AllowedRawPointer<ClassType>, Args...> args;
@@ -1325,7 +1325,7 @@ struct RegisterClassMethod<ReturnType (ClassType::*)(Args...) const> {
13251325
template <typename CT, typename... Policies>
13261326
static void invoke(const char* methodName,
13271327
ReturnType (ClassType::*memberFunction)(Args...) const) {
1328-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
1328+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
13291329
auto invoke = MethodInvoker<ReturnPolicy, decltype(memberFunction), ReturnType, const ClassType*, Args...>::invoke;
13301330

13311331
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, AllowedRawPointer<const ClassType>, Args...> args;
@@ -1356,7 +1356,7 @@ struct RegisterClassMethod<ReturnType (*)(ThisType, Args...)> {
13561356
static void invoke(const char* methodName,
13571357
ReturnType (*function)(ThisType, Args...)) {
13581358
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, ThisType, Args...> args;
1359-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
1359+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
13601360
auto invoke = FunctionInvoker<ReturnPolicy, decltype(function), ReturnType, ThisType, Args...>::invoke;
13611361
_embind_register_class_function(
13621362
TypeID<ClassType>::get(),
@@ -1385,7 +1385,7 @@ struct RegisterClassMethod<std::function<ReturnType (ThisType, Args...)>> {
13851385
static void invoke(const char* methodName,
13861386
std::function<ReturnType (ThisType, Args...)> function) {
13871387
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, ThisType, Args...> args;
1388-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
1388+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
13891389
auto invoke = FunctorInvoker<ReturnPolicy, decltype(function), ReturnType, ThisType, Args...>::invoke;
13901390
_embind_register_class_function(
13911391
TypeID<ClassType>::get(),
@@ -1408,7 +1408,7 @@ struct RegisterClassMethod<FunctionTag<Callable, ReturnType (ThisType, Args...)>
14081408
static void invoke(const char* methodName,
14091409
Callable& callable) {
14101410
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, ThisType, Args...> args;
1411-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
1411+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
14121412
auto invoke = FunctorInvoker<ReturnPolicy, decltype(callable), ReturnType, ThisType, Args...>::invoke;
14131413
_embind_register_class_function(
14141414
TypeID<ClassType>::get(),
@@ -1546,7 +1546,7 @@ class class_ {
15461546
smart_ptr<SmartPtr>(smartPtrName);
15471547

15481548
typename WithPolicies<Policies...>::template ArgTypeList<SmartPtr, Args...> args;
1549-
using ReturnPolicy = GetReturnValuePolicy<SmartPtr, return_value_policy::take_ownership>::tag;
1549+
using ReturnPolicy = typename GetReturnValuePolicy<SmartPtr, return_value_policy::take_ownership>::tag;
15501550
auto invoke = &Invoker<ReturnPolicy, SmartPtr, Args...>::invoke;
15511551
_embind_register_class_constructor(
15521552
TypeID<ClassType>::get(),
@@ -1646,7 +1646,7 @@ class class_ {
16461646
std::conjunction<internal::isPolicy<Policies>...>::value>::type>
16471647
EMSCRIPTEN_ALWAYS_INLINE const class_& property(const char* fieldName, const FieldType ClassType::*field, Policies...) const {
16481648
using namespace internal;
1649-
using ReturnPolicy = GetReturnValuePolicy<FieldType, Policies...>::tag;
1649+
using ReturnPolicy = typename GetReturnValuePolicy<FieldType, Policies...>::tag;
16501650
typename WithPolicies<Policies...>::template ArgTypeList<FieldType> returnType;
16511651

16521652
auto getter = &MemberAccess<ClassType, FieldType>::template getWire<ClassType, ReturnPolicy>;
@@ -1674,7 +1674,7 @@ class class_ {
16741674
std::conjunction<internal::isPolicy<Policies>...>::value>::type>
16751675
EMSCRIPTEN_ALWAYS_INLINE const class_& property(const char* fieldName, FieldType ClassType::*field, Policies...) const {
16761676
using namespace internal;
1677-
using ReturnPolicy = GetReturnValuePolicy<FieldType, Policies...>::tag;
1677+
using ReturnPolicy = typename GetReturnValuePolicy<FieldType, Policies...>::tag;
16781678
typename WithPolicies<Policies...>::template ArgTypeList<FieldType> returnType;
16791679

16801680
auto getter = &MemberAccess<ClassType, FieldType>::template getWire<ClassType, ReturnPolicy>;
@@ -1708,7 +1708,7 @@ class class_ {
17081708
typename std::conditional<std::is_same<PropertyType, internal::DeduceArgumentsTag>::value,
17091709
Getter,
17101710
FunctionTag<Getter, PropertyType>>::type> GP;
1711-
using ReturnPolicy = GetReturnValuePolicy<typename GP::ReturnType, Policies...>::tag;
1711+
using ReturnPolicy = typename GetReturnValuePolicy<typename GP::ReturnType, Policies...>::tag;
17121712
auto gter = &GP::template get<ClassType, ReturnPolicy>;
17131713
typename WithPolicies<Policies...>::template ArgTypeList<typename GP::ReturnType> returnType;
17141714
_embind_register_class_property(
@@ -1747,7 +1747,7 @@ class class_ {
17471747
FunctionTag<Setter, PropertyType>>::type> SP;
17481748

17491749

1750-
using ReturnPolicy = GetReturnValuePolicy<typename GP::ReturnType, Policies...>::tag;
1750+
using ReturnPolicy = typename GetReturnValuePolicy<typename GP::ReturnType, Policies...>::tag;
17511751
auto gter = &GP::template get<ClassType, ReturnPolicy>;
17521752
auto ster = &SP::template set<ClassType>;
17531753

@@ -1776,7 +1776,7 @@ class class_ {
17761776
using namespace internal;
17771777

17781778
typename WithPolicies<Policies...>::template ArgTypeList<ReturnType, Args...> args;
1779-
using ReturnPolicy = GetReturnValuePolicy<ReturnType, Policies...>::tag;
1779+
using ReturnPolicy = typename GetReturnValuePolicy<ReturnType, Policies...>::tag;
17801780
auto invoke = internal::Invoker<ReturnPolicy, ReturnType, Args...>::invoke;
17811781
_embind_register_class_class_function(
17821782
TypeID<ClassType>::get(),

system/include/emscripten/em_js.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@
7979
// additional macro later is added these will be expanded and we want
8080
// to make sure the resulting expansion doesn't break the expectations
8181
// of JS code
82+
#include <stdbool.h>
8283
#if defined(true) && defined(false)
8384
#undef true
8485
#undef false

system/include/emscripten/em_types.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
* found in the LICENSE file.
66
*/
77

8-
#include <stdbool.h>
9-
108
#pragma once
119

1210
#include <stdbool.h>

system/include/emscripten/emscripten.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@
2121
*/
2222

2323
#include "em_asm.h"
24+
#include "em_js.h"
2425
#include "em_macros.h"
2526
#include "em_types.h"
26-
#include "em_js.h"
2727
#include "promise.h"
28-
#include "wget.h"
2928
#include "version.h"
29+
#include "wget.h"
3030

3131
#ifdef __EMSCRIPTEN__
3232
#ifndef EMSCRIPTEN

system/include/emscripten/fetch.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@
77

88
#pragma once
99

10+
#include <emscripten/em_types.h>
11+
1012
#include <limits.h>
1113
#include <stdbool.h>
1214
#include <stddef.h>
1315
#include <stdint.h>
14-
#include <emscripten/em_types.h>
1516

1617
#ifdef __cplusplus
1718
extern "C" {

system/include/emscripten/fiber.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@
77

88
#pragma once
99

10-
#include <stdint.h>
11-
#include <stddef.h>
12-
1310
#include <emscripten/emscripten.h>
1411

12+
#include <stddef.h>
13+
#include <stdint.h>
14+
1515
#ifdef __cplusplus
1616
extern "C" {
1717
#endif

system/include/emscripten/heap.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,13 @@
77

88
#pragma once
99

10+
#include <emscripten/emscripten.h>
11+
1012
#include <stdbool.h>
1113
#include <stddef.h>
14+
#include <stddef.h>
1215
#include <stdint.h>
13-
#include <emscripten/emscripten.h>
1416
#include <stdint.h>
15-
#include <stddef.h>
1617

1718
#define WASM_PAGE_SIZE 65536
1819
#define EMSCRIPTEN_PAGE_SIZE WASM_PAGE_SIZE

system/include/emscripten/html5.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,17 @@
77

88
#pragma once
99

10-
#include <pthread.h>
1110
#include <emscripten/em_types.h>
12-
1311
#include <emscripten/emscripten.h>
1412

1513
// Include eventloop.h, console.h and html5_webgl.h for compat with older
1614
// version of this header that used to define these functions.
17-
#include <emscripten/eventloop.h>
1815
#include <emscripten/console.h>
16+
#include <emscripten/eventloop.h>
1917
#include <emscripten/html5_webgl.h>
2018

19+
#include <pthread.h>
20+
2121
#ifdef __cplusplus
2222
extern "C" {
2323
#endif

system/include/emscripten/html5_webgl.h

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77

88
#pragma once
99

10-
#include <stdint.h>
1110
#include <emscripten/html5.h>
1211

12+
#include <stdint.h>
13+
#include <pthread.h>
14+
1315
#ifdef __cplusplus
1416
extern "C" {
1517
#endif

0 commit comments

Comments
 (0)