Skip to content

Commit cce9ae7

Browse files
authored
Merge pull request swiftlang#76814 from gottesmm/pr-6413df7cbed605312aee2525fa8079b8a161d897
Fix syntax highlighting by changing how we include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
2 parents 90e2b60 + cb8e8b5 commit cce9ae7

17 files changed

+54
-27
lines changed

stdlib/public/CompatibilityOverride/CompatibilityOverride.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ struct OverrideSection {
4343

4444
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
4545
Override_ ## name name;
46-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
46+
#include "CompatibilityOverrideIncludePath.h"
4747
};
4848

4949
static_assert(std::is_pod<OverrideSection>::value,
@@ -98,6 +98,6 @@ static OverrideSection *getOverrideSectionPtr() {
9898
Section->name; \
9999
}
100100

101-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
101+
#include "CompatibilityOverrideIncludePath.h"
102102

103103
#endif // #ifdef SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT

stdlib/public/CompatibilityOverride/CompatibilityOverride.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -120,9 +120,9 @@ namespace swift {
120120
#define COMPATIBILITY_PAREN_PARAMS(...) (__VA_ARGS__)
121121
#define COMPATIBILITY_PAREN_COMPATIBILITY_PAREN2 ()
122122

123-
// Include path computation. Code that includes this file can write
124-
// `#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH` to include the appropriate
125-
// .def file for the current library.
123+
// Include path computation. Code that includes this file can write `#include
124+
// "..CompatibilityOverride/CompatibilityOverrideIncludePath.h"` to include the
125+
// appropriate .def file for the current library.
126126
#define COMPATIBILITY_OVERRIDE_INCLUDE_PATH_swiftRuntime \
127127
"../CompatibilityOverride/CompatibilityOverrideRuntime.def"
128128
#define COMPATIBILITY_OVERRIDE_INCLUDE_PATH_swift_Concurrency \
@@ -173,18 +173,18 @@ namespace swift {
173173
// Create typedefs for function pointers to call the original implementation.
174174
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
175175
ccAttrs typedef ret(*Original_##name) COMPATIBILITY_PAREN(typedArgs);
176-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
176+
#include "CompatibilityOverrideIncludePath.h"
177177

178178
// Create typedefs for override function pointers.
179179
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
180180
ccAttrs typedef ret (*Override_##name)(COMPATIBILITY_UNPAREN_WITH_COMMA( \
181181
typedArgs) Original_##name originalImpl);
182-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
182+
#include "CompatibilityOverrideIncludePath.h"
183183

184184
// Create declarations for getOverride functions.
185-
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
186-
Override_ ## name getOverride_ ## name();
187-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
185+
#define OVERRIDE(name, ret, attrs, ccAttrs, namespace, typedArgs, namedArgs) \
186+
Override_##name getOverride_##name();
187+
#include "CompatibilityOverrideIncludePath.h"
188188

189189
/// Used to define an override point. The override point #defines the appropriate
190190
/// OVERRIDE macro from CompatibilityOverride.def to this macro, then includes
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
//===--- CompatibilityOverrideIncludePath.h -------------------------------===//
2+
//
3+
// This source file is part of the Swift.org open source project
4+
//
5+
// Copyright (c) 2014 - 2024 Apple Inc. and the Swift project authors
6+
// Licensed under Apache License v2.0 with Runtime Library Exception
7+
//
8+
// See https://swift.org/LICENSE.txt for license information
9+
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
10+
//
11+
//===----------------------------------------------------------------------===//
12+
///
13+
/// \file This file should be included instead of including
14+
/// COMPATIBILITY_OVERRIDE_INCLUDE_PATH directly to ensure that syntax
15+
/// highlighting in certain errors is not broken. It is assumed that
16+
/// CompatibilityOverride.h is already included.
17+
///
18+
//===----------------------------------------------------------------------===//
19+
20+
#ifndef COMPATIBILITY_OVERRIDE_H
21+
#error "Must define COMPATIBILITY_OVERRIDE_H before including this file"
22+
#endif
23+
24+
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH

stdlib/public/Concurrency/Actor.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,8 +2310,7 @@ void swift::swift_executor_escalate(SerialExecutorRef executor, AsyncTask *task,
23102310
}
23112311

23122312
#define OVERRIDE_ACTOR COMPATIBILITY_OVERRIDE
2313-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
2314-
2313+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"
23152314

23162315
/*****************************************************************************/
23172316
/***************************** DISTRIBUTED ACTOR *****************************/

stdlib/public/Concurrency/AsyncLet.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,4 +577,4 @@ void AsyncLet::setDidAllocateFromParentTask(bool value) {
577577
// =============================================================================
578578

579579
#define OVERRIDE_ASYNC_LET COMPATIBILITY_OVERRIDE
580-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
580+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"

stdlib/public/Concurrency/GlobalExecutor.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,4 +233,4 @@ bool SerialExecutorRef::isMainExecutor() const {
233233
}
234234

235235
#define OVERRIDE_GLOBAL_EXECUTOR COMPATIBILITY_OVERRIDE
236-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
236+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"

stdlib/public/Concurrency/Task.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1832,4 +1832,4 @@ static void swift_task_startOnMainActorImpl(AsyncTask* task) {
18321832
}
18331833
#endif // #else SWIFT_STDLIB_SUPPORT_BACK_DEPLOYMENT
18341834

1835-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
1835+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"

stdlib/public/Concurrency/TaskGroup.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2084,4 +2084,4 @@ static bool swift_taskGroup_addPendingImpl(TaskGroup *_group, bool unconditional
20842084
}
20852085

20862086
#define OVERRIDE_TASK_GROUP COMPATIBILITY_OVERRIDE
2087-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
2087+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"

stdlib/public/Concurrency/TaskLocal.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -536,4 +536,4 @@ void TaskLocal::Storage::copyToOnlyOnlyFromCurrentGroup(AsyncTask *target) {
536536
}
537537

538538
#define OVERRIDE_TASK_LOCAL COMPATIBILITY_OVERRIDE
539-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
539+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"

stdlib/public/Concurrency/TaskStatus.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1118,4 +1118,4 @@ void TaskDependencyStatusRecord::performEscalationAction(JobPriority newPriority
11181118
}
11191119

11201120
#define OVERRIDE_TASK_STATUS COMPATIBILITY_OVERRIDE
1121-
#include COMPATIBILITY_OVERRIDE_INCLUDE_PATH
1121+
#include "../CompatibilityOverride/CompatibilityOverrideIncludePath.h"

0 commit comments

Comments
 (0)