mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
Support build and target configurations
These changes add support for build and target configurations in the compiler. Build and target configurations, combined with the use of #if/#else/#endif allow for conditional compilation within declaration and statement contexts. Build configurations can be passed into the compiler via the new '-D' flag, or set within the LangOptions class. Target configurations are implicit, and currently only "os" and "arch" are supported. Swift SVN r14305
This commit is contained in:
15
test/BuildConfigurations/basicParseErrors.swift
Normal file
15
test/BuildConfigurations/basicParseErrors.swift
Normal file
@@ -0,0 +1,15 @@
|
||||
// RUN: %swift -parse %s -verify -D FOO -D BAZ
|
||||
// REQUIRES: X86
|
||||
|
||||
#if FOO == BAZ // expected-error{{expected '&&' or '||' expression}}
|
||||
var x = 0
|
||||
#endif
|
||||
|
||||
#if ^FOO // expected-error{{expected unary '!' expression}}
|
||||
var y = 0
|
||||
#endif
|
||||
|
||||
#if swift(FOO) // expected-error{{unexpected target configuration expression (expected 'os' or 'arch')}}
|
||||
var z = 0
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user