Skip to content

Commit ecad623

Browse files
committed
🎨 Provide better control over freestanding
Problem: - The `SIMULATE_FREESTANDING` macro applies to multiple repos. Sometimes we might want finer-grained control over which elements of which repos are freestanding-compatible, because toolchains differ in what they support. Solution: - Introduce `CONC_FREESTANDING` for this repo control. - Defining `SIMULATE_FREESTANDING` will also control `CONC_FREESTANDING`.
1 parent 620f788 commit ecad623

File tree

4 files changed

+11
-5
lines changed

4 files changed

+11
-5
lines changed

include/conc/concurrency.hpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,14 @@
11
#pragma once
22

3-
#ifdef SIMULATE_FREESTANDING
3+
#include <conc/concepts.hpp>
4+
#include <conc/detail/freestanding.hpp>
5+
6+
#ifdef CONC_FREESTANDING
47
#define HAS_MUTEX 0
58
#else
69
#define HAS_MUTEX __has_include(<mutex>)
710
#endif
811

9-
#include <conc/concepts.hpp>
10-
1112
#if HAS_MUTEX
1213
#include <mutex>
1314
#endif
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#pragma once
2+
3+
#ifdef SIMULATE_FREESTANDING
4+
#define CONC_FREESTANDING
5+
#endif

test/fail_no_conc_policy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define SIMULATE_FREESTANDING
1+
#define CONC_FREESTANDING
22

33
#include <conc/concurrency.hpp>
44

test/freestanding_conc_injected_policy.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
#define SIMULATE_FREESTANDING
1+
#define CONC_FREESTANDING
22

33
#include <conc/concepts.hpp>
44
#include <conc/concurrency.hpp>

0 commit comments

Comments
 (0)