Skip to content

Commit e41fe5a

Browse files
committed
Special case some unknown builtin macros
1 parent 31aed27 commit e41fe5a

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

lib/ASTGen/Sources/ASTGen/Macros.swift

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,20 @@ func checkMacroDefinition(
255255
case "ExternalMacro":
256256
return Int(BridgedMacroDefinitionKind.builtinExternalMacro.rawValue)
257257

258+
// These builtins don't exist, but are put into the standard library at
259+
// least for documentation purposes right now. Don't emit a warning for
260+
// them, but do fail operation.
261+
case "FileIDMacro",
262+
"FilePathMacro",
263+
"FileMacro",
264+
"FunctionMacro",
265+
"LineMacro",
266+
"ColumnMacro",
267+
"DSOHandleMacro",
268+
"WarningMacro",
269+
"ErrorMacro":
270+
return -1
271+
258272
default:
259273
// Warn about the unknown builtin.
260274
let srcMgr = SourceManager(cxxDiagnosticEngine: diagEnginePtr)

stdlib/public/core/Macros.swift

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@
2525
public macro externalMacro<T>(module: String, type: String) -> T =
2626
Builtin.ExternalMacro
2727

28-
#if false
29-
3028
// File and path-related information
3129

3230
/// Produces a unique identifier for the given source file, comprised of
@@ -73,6 +71,4 @@ public macro warning(_ message: String) = Builtin.WarningMacro
7371
@freestanding(declaration)
7472
public macro error(_ message: String) = Builtin.ErrorMacro
7573

76-
#endif // false
77-
7874
#endif // $Macros && hasAttribute(attached)

0 commit comments

Comments
 (0)