Skip to content

Commit a52dc0f

Browse files
Fix or add missing include guards
Add UMF_ prefix, where missing. In bench, tests, and examples use UMF_X_ prefix.
1 parent 04f8646 commit a52dc0f

20 files changed

+73
-47
lines changed

benchmark/multithread.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*
88
*/
99

10+
#ifndef UMF_BENCH_MULTITHREAD_HPP
11+
#define UMF_BENCH_MULTITHREAD_HPP
12+
1013
#include <algorithm>
1114
#include <chrono>
1215
#include <cmath>
@@ -87,3 +90,5 @@ template <typename T> double std_dev(const std::vector<T> &values) {
8790
}
8891

8992
} // namespace umf_bench
93+
94+
#endif /* UMF_BENCH_MULTITHREAD_HPP */

examples/common/utils_level_zero.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*
88
*/
99

10+
#ifndef UMF_EXAMPLE_UTILS_LEVEL_ZERO_H
11+
#define UMF_EXAMPLE_UTILS_LEVEL_ZERO_H
12+
1013
#include <stdio.h>
1114
#include <stdlib.h>
1215

@@ -412,3 +415,5 @@ int destroy_context(ze_context_handle_t context) {
412415

413416
return 0;
414417
}
418+
419+
#endif // UMF_EXAMPLE_UTILS_LEVEL_ZERO_H

src/cpp_helpers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
*
88
*/
99

10-
#ifndef UMF_HELPERS_H
11-
#define UMF_HELPERS_H 1
10+
#ifndef UMF_HELPERS_HPP
11+
#define UMF_HELPERS_HPP 1
1212

1313
#include <umf/memory_pool.h>
1414
#include <umf/memory_pool_ops.h>
@@ -164,4 +164,4 @@ template <typename Type> umf_result_t &getPoolLastStatusRef() {
164164

165165
} // namespace umf
166166

167-
#endif /* UMF_HELPERS_H */
167+
#endif /* UMF_HELPERS_HPP */

src/critnib/critnib.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
*
88
*/
99

10-
#ifndef CRITNIB_H
11-
#define CRITNIB_H 1
10+
#ifndef UMF_CRITNIB_H
11+
#define UMF_CRITNIB_H 1
1212

1313
#include <stdint.h>
1414

@@ -44,4 +44,4 @@ void critnib_iter(critnib *c, uintptr_t min, uintptr_t max,
4444
}
4545
#endif
4646

47-
#endif
47+
#endif // UMF_CRITNIB_H

src/utils/utils_math.h

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,15 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
77
*
88
*/
99

10+
#ifndef UMF_MATH_H
11+
#define UMF_MATH_H 1
12+
1013
#include <assert.h>
1114
#include <stddef.h>
1215

@@ -22,3 +25,5 @@ static inline size_t log2Utils(size_t num) { return getLeftmostSetBitPos(num); }
2225
#ifdef __cplusplus
2326
}
2427
#endif
28+
29+
#endif /* UMF_MATH_H */

test/common/base.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

test/common/ipc_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*/
77

8-
#ifndef IPC_COMMON_H
9-
#define IPC_COMMON_H
8+
#ifndef UMF_TEST_IPC_COMMON_H
9+
#define UMF_TEST_IPC_COMMON_H
1010

1111
#include <umf/memory_provider.h>
1212

@@ -24,4 +24,4 @@ int run_consumer(int port, umf_memory_provider_ops_t *provider_ops,
2424
void *provider_params, memcopy_callback_t memcopy_callback,
2525
void *memcopy_ctx);
2626

27-
#endif // IPC_COMMON_H
27+
#endif // UMF_TEST_IPC_COMMON_H

test/common/ipc_os_prov_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*/
77

8-
#ifndef IPC_OS_PROV_COMMON_H
9-
#define IPC_OS_PROV_COMMON_H
8+
#ifndef UMF_TEST_IPC_OS_PROV_COMMON_H
9+
#define UMF_TEST_IPC_OS_PROV_COMMON_H
1010

1111
#include <stdlib.h>
1212

1313
void memcopy(void *dst, const void *src, size_t size, void *context);
1414

15-
#endif // IPC_OS_PROV_COMMON_H
15+
#endif // UMF_TEST_IPC_OS_PROV_COMMON_H

test/common/multithread_helpers.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,9 @@
77
*
88
*/
99

10+
#ifndef UMF_TEST_MULTITHREAD_HELPERS_HPP
11+
#define UMF_TEST_MULTITHREAD_HELPERS_HPP
12+
1013
#include <condition_variable>
1114
#include <memory>
1215
#include <mutex>
@@ -84,3 +87,5 @@ struct syncthreads_barrier {
8487
};
8588

8689
} // namespace umf_test
90+
91+
#endif /* UMF_TEST_MULTITHREAD_HELPERS_HPP */

test/common/numa_helpers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_NUMA_HELPERS_H
6-
#define UMF_NUMA_HELPERS_H 1
5+
#ifndef UMF_TEST_NUMA_HELPERS_H
6+
#define UMF_TEST_NUMA_HELPERS_H 1
77

88
#include <numa.h>
99
#include <numaif.h>
@@ -31,4 +31,4 @@ int getNumaNodeByPtr(void *ptr) {
3131
}
3232
#endif
3333

34-
#endif /* UMF_NUMA_HELPERS_H */
34+
#endif /* UMF_TEST_NUMA_HELPERS_H */

test/common/pool.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
*
3-
* Copyright (C) 2023 Intel Corporation
3+
* Copyright (C) 2023-2024 Intel Corporation
44
*
55
* Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
66
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception

test/common/pool_null.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_NULL_POOL_H
6-
#define UMF_NULL_POOL_H
5+
#ifndef UMF_TEST_NULL_POOL_H
6+
#define UMF_TEST_NULL_POOL_H
77

88
#include <umf/memory_pool.h>
99

@@ -17,4 +17,4 @@ extern umf_memory_pool_ops_t UMF_NULL_POOL_OPS;
1717
}
1818
#endif
1919

20-
#endif // UMF_NULL_POOL_H
20+
#endif // UMF_TEST_NULL_POOL_H

test/common/pool_trace.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_TRACE_POOL_H
6-
#define UMF_TRACE_POOL_H
5+
#ifndef UMF_TEST_TRACE_POOL_H
6+
#define UMF_TEST_TRACE_POOL_H
77

88
#include <umf/memory_pool.h>
99

@@ -24,4 +24,4 @@ extern umf_memory_pool_ops_t UMF_TRACE_POOL_OPS;
2424
}
2525
#endif
2626

27-
#endif // UMF_TRACE_POOL_H
27+
#endif // UMF_TEST_TRACE_POOL_H

test/common/provider_null.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_NULL_PROVIDER_H
6-
#define UMF_NULL_PROVIDER_H
5+
#ifndef UMF_TEST_NULL_PROVIDER_H
6+
#define UMF_TEST_NULL_PROVIDER_H
77

88
#include <umf/memory_provider.h>
99

@@ -17,4 +17,4 @@ extern umf_memory_provider_ops_t UMF_NULL_PROVIDER_OPS;
1717
}
1818
#endif
1919

20-
#endif // UMF_NULL_PROVIDER_H
20+
#endif // UMF_TEST_NULL_PROVIDER_H

test/common/provider_trace.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
// Copyright (C) 2023 Intel Corporation
1+
// Copyright (C) 2023-2024 Intel Corporation
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_TRACE_PROVIDER_H
6-
#define UMF_TRACE_PROVIDER_H
5+
#ifndef UMF_TEST_TRACE_PROVIDER_H
6+
#define UMF_TEST_TRACE_PROVIDER_H
77

88
#include <stdbool.h>
99

@@ -27,4 +27,4 @@ extern umf_memory_provider_ops_t UMF_TRACE_PROVIDER_OPS;
2727
}
2828
#endif
2929

30-
#endif // UMF_TRACE_PROVIDER_H
30+
#endif // UMF_TEST_TRACE_PROVIDER_H

test/fuzz/utils.hpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5+
#ifndef UMF_TEST_FUZZ_UTILS_HPP
6+
#define UMF_TEST_FUZZ_UTILS_HPP
7+
58
#include "umf/pools/pool_scalable.h"
69
#include "umf/providers/provider_os_memory.h"
710
#include <fuzzer/FuzzedDataProvider.h>
@@ -75,3 +78,5 @@ struct TestState {
7578
}
7679
};
7780
} // namespace fuzz
81+
82+
#endif /* UMF_TEST_FUZZ_UTILS_HPP */

test/memspaces/memspace_fixtures.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_MEMSPACE_FIXTURES_HPP
6-
#define UMF_MEMSPACE_FIXTURES_HPP
5+
#ifndef UMF_TEST_MEMSPACE_FIXTURES_HPP
6+
#define UMF_TEST_MEMSPACE_FIXTURES_HPP
7+
78
#include <numa.h>
89
#include <numaif.h>
910
#include <thread>
@@ -218,4 +219,4 @@ TEST_P(memspaceProviderTest, allocLocalMt) {
218219
}
219220
}
220221

221-
#endif /* UMF_MEMSPACE_FIXTURES_HPP */
222+
#endif /* UMF_TEST_MEMSPACE_FIXTURES_HPP */

test/memspaces/memspace_helpers.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Under the Apache License v2.0 with LLVM Exceptions. See LICENSE.TXT.
33
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
44

5-
#ifndef UMF_MEMSPACE_HELPERS_HPP
6-
#define UMF_MEMSPACE_HELPERS_HPP
5+
#ifndef UMF_TEST_MEMSPACE_HELPERS_HPP
6+
#define UMF_TEST_MEMSPACE_HELPERS_HPP
77

88
#include "base.hpp"
99
#include "memspace_internal.h"
@@ -56,4 +56,4 @@ void getAllocationPolicy(void *ptr, unsigned long maxNodeId, int &mode,
5656
allocNodeId = static_cast<size_t>(nodeId);
5757
}
5858

59-
#endif /* UMF_MEMSPACE_HELPERS_HPP */
59+
#endif /* UMF_TEST_MEMSPACE_HELPERS_HPP */

test/providers/ipc_level_zero_prov_common.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,11 @@
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*/
77

8-
#ifndef IPC_LEVEL_ZERO_PROV_COMMON_H
9-
#define IPC_LEVEL_ZERO_PROV_COMMON_H
8+
#ifndef UMF_TEST_IPC_LEVEL_ZERO_PROV_COMMON_H
9+
#define UMF_TEST_IPC_LEVEL_ZERO_PROV_COMMON_H
1010

1111
#include <stddef.h>
1212

1313
void memcopy(void *dst, const void *src, size_t size, void *context);
1414

15-
#endif // IPC_LEVEL_ZERO_PROV_COMMON_H
15+
#endif // UMF_TEST_IPC_LEVEL_ZERO_PROV_COMMON_H

test/providers/level_zero_helpers.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
* SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
66
*/
77

8-
#ifndef TEST_COMMON_LEVEL_ZERO_HELPERS_HPP
9-
#define TEST_COMMON_LEVEL_ZERO_HELPERS_HPP
8+
#ifndef UMF_TEST_LEVEL_ZERO_HELPERS_H
9+
#define UMF_TEST_LEVEL_ZERO_HELPERS_H
1010

1111
#include <umf/providers/provider_level_zero.h>
1212

@@ -45,4 +45,4 @@ create_level_zero_prov_params(umf_usm_memory_type_t memory_type);
4545
}
4646
#endif
4747

48-
#endif // TEST_COMMON_LEVEL_ZERO_HELPERS_HPP
48+
#endif // UMF_TEST_LEVEL_ZERO_HELPERS_H

0 commit comments

Comments
 (0)