Skip to content

Commit b17088e

Browse files
Update the CLanguageStandard and CXXLanguageStandard enums (#3079)
1 parent a8ded58 commit b17088e

File tree

2 files changed

+117
-45
lines changed

2 files changed

+117
-45
lines changed

Sources/PackageDescription/LanguageStandardSettings.swift

Lines changed: 115 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,75 +1,147 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2018 Apple Inc. and the Swift project authors
4+
Copyright (c) 2017 - 2020 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See http://swift.org/LICENSE.txt for license information
88
See http://swift.org/CONTRIBUTORS.txt for Swift project authors
99
*/
1010

1111
/// The supported C language standard to use for compiling C sources in the package.
12+
///
13+
/// Aliases are available for some C language standards. For example,
14+
/// use `c89`, `c90`, or `iso9899_1990` for the "ISO C 1990" standard.
15+
/// To learn more, read the [Clang Compiler User's Manual][1].
16+
///
17+
/// [1]: <https://clang.llvm.org/docs/UsersManual.html#differences-between-various-standard-modes>
1218
public enum CLanguageStandard: String, Encodable {
13-
/// The identifier for the C89 language standard.
19+
20+
/// ISO C 1990.
1421
case c89
15-
/// The identifier for the C90 language standard.
22+
23+
/// ISO C 1990.
1624
case c90
17-
/// The identifier for the ISO 9899:1990 language standard.
18-
case iso9899_1990 = "iso9899:1990"
19-
/// The identifier for the ISO 9899:1994 language standard.
20-
case iso9899_199409 = "iso9899:1994"
21-
/// The identifier for the GNU89 language standard.
25+
26+
/// ISO C 1999.
27+
case c99
28+
29+
/// ISO C 2011.
30+
case c11
31+
32+
/// ISO C 2017.
33+
@available(_PackageDescription, introduced: 999.0)
34+
case c17
35+
36+
/// ISO C 2017.
37+
@available(_PackageDescription, introduced: 999.0)
38+
case c18
39+
40+
/// Working Draft for ISO C2x.
41+
@available(_PackageDescription, introduced: 999.0)
42+
case c2x
43+
44+
/// ISO C 1990 with GNU extensions.
2245
case gnu89
23-
/// The identifier for the GNU90 language standard.
46+
47+
/// ISO C 1990 with GNU extensions.
2448
case gnu90
25-
/// The identifier for the C99 language standard.
26-
case c99
27-
/// The identifier for the ISO 9899:1999 language standard.
28-
case iso9899_1999 = "iso9899:1999"
29-
/// The identifier for the GNU99 language standard.
49+
50+
/// ISO C 1999 with GNU extensions.
3051
case gnu99
31-
/// The identifier for the C11 language standard.
32-
case c11
33-
/// The identifier for the ISO 9899:2011 language standard.
34-
case iso9899_2011 = "iso9899:2011"
35-
/// The identifier for the GNU11 language standard.
52+
53+
/// ISO C 2011 with GNU extensions.
3654
case gnu11
55+
56+
/// ISO C 2017 with GNU extensions.
57+
@available(_PackageDescription, introduced: 999.0)
58+
case gnu17
59+
60+
/// ISO C 2017 with GNU extensions.
61+
@available(_PackageDescription, introduced: 999.0)
62+
case gnu18
63+
64+
/// Working Draft for ISO C2x with GNU extensions.
65+
@available(_PackageDescription, introduced: 999.0)
66+
case gnu2x
67+
68+
/// ISO C 1990.
69+
case iso9899_1990 = "iso9899:1990"
70+
71+
/// ISO C 1990 with amendment 1.
72+
case iso9899_199409 = "iso9899:199409"
73+
74+
/// ISO C 1999.
75+
case iso9899_1999 = "iso9899:1999"
76+
77+
/// ISO C 2011.
78+
case iso9899_2011 = "iso9899:2011"
79+
80+
/// ISO C 2017.
81+
@available(_PackageDescription, introduced: 999.0)
82+
case iso9899_2017 = "iso9899:2017"
83+
84+
/// ISO C 2017.
85+
@available(_PackageDescription, introduced: 999.0)
86+
case iso9899_2018 = "iso9899:2018"
3787
}
3888

39-
/// The supported C++ language standards to use for compiling C++ sources in the package.
89+
/// The supported C++ language standard to use for compiling C++ sources in the package.
90+
///
91+
/// Aliases are available for some C++ language standards. For example,
92+
/// use `cxx98` or `cxx03` for the "ISO C++ 1998 with amendments" standard.
93+
/// To learn more, read the [C++ Support in Clang][1] status page.
94+
///
95+
/// [1]: <https://clang.llvm.org/cxx_status.html>
4096
public enum CXXLanguageStandard: String, Encodable {
41-
/// The identifier for the C++98 language standard.
97+
98+
/// ISO C++ 1998 with amendments.
4299
case cxx98 = "c++98"
43-
/// The identifier for the C++03 language standard.
100+
101+
/// ISO C++ 1998 with amendments.
44102
case cxx03 = "c++03"
45-
/// The identifier for the GNU++98 language standard.
46-
case gnucxx98 = "gnu++98"
47-
/// The identifier for the GNU++03 language standard.
48-
case gnucxx03 = "gnu++03"
49-
/// The identifier for the C++11 language standard.
103+
104+
/// ISO C++ 2011 with amendments.
50105
case cxx11 = "c++11"
51-
/// The identifier for the GNU++11 language standard.
52-
case gnucxx11 = "gnu++11"
53-
/// The identifier for the C++14 language standard.
106+
107+
/// ISO C++ 2014 with amendments.
54108
case cxx14 = "c++14"
55-
/// The identifier for the GNU++14 language standard.
56-
case gnucxx14 = "gnu++14"
57-
/// The identifier for the C++1z language standard.
58-
case cxx1z = "c++1z"
59-
/// The identifier for the GNU++1z language standard.
60-
case gnucxx1z = "gnu++1z"
61-
/// The identifier for the C++17 language standard.
109+
110+
/// ISO C++ 2017 with amendments.
62111
@available(_PackageDescription, introduced: 999.0)
63112
case cxx17 = "c++17"
64-
/// The identifier for the GNU++17 language standard.
113+
114+
/// ISO C++ 2017 with amendments.
115+
@available(_PackageDescription, introduced: 4, deprecated: 999.0, renamed: "cxx17")
116+
case cxx1z = "c++1z"
117+
118+
/// ISO C++ 2020 DIS.
65119
@available(_PackageDescription, introduced: 999.0)
66-
case gnucxx17 = "gnu++17"
67-
/// The identifier for the C++2a language standard.
120+
case cxx20 = "c++20"
121+
122+
/// ISO C++ 1998 with amendments and GNU extensions.
123+
case gnucxx98 = "gnu++98"
124+
125+
/// ISO C++ 1998 with amendments and GNU extensions.
126+
case gnucxx03 = "gnu++03"
127+
128+
/// ISO C++ 2011 with amendments and GNU extensions.
129+
case gnucxx11 = "gnu++11"
130+
131+
/// ISO C++ 2014 with amendments and GNU extensions.
132+
case gnucxx14 = "gnu++14"
133+
134+
/// ISO C++ 2017 with amendments and GNU extensions.
68135
@available(_PackageDescription, introduced: 999.0)
69-
case cxx2a = "c++2a"
70-
/// The identifier for the GNU++2a language standard.
136+
case gnucxx17 = "gnu++17"
137+
138+
/// ISO C++ 2017 with amendments and GNU extensions.
139+
@available(_PackageDescription, introduced: 4, deprecated: 999.0, renamed: "gnucxx17")
140+
case gnucxx1z = "gnu++1z"
141+
142+
/// ISO C++ 2020 DIS with GNU extensions.
71143
@available(_PackageDescription, introduced: 999.0)
72-
case gnucxx2a = "gnu++2a"
144+
case gnucxx20 = "gnu++20"
73145
}
74146

75147
#if !PACKAGE_DESCRIPTION_4

Tests/PackageLoadingTests/PD4LoadingTests.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
/*
22
This source file is part of the Swift.org open source project
33

4-
Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
4+
Copyright (c) 2017 - 2020 Apple Inc. and the Swift project authors
55
Licensed under Apache License v2.0 with Runtime Library Exception
66

77
See http://swift.org/LICENSE.txt for license information
@@ -322,7 +322,7 @@ class PackageDescription4LoadingTests: PackageDescriptionLoadingTests {
322322
"""
323323
loadManifest(stream.bytes) { manifest in
324324
XCTAssertEqual(manifest.name, "testPackage")
325-
XCTAssertEqual(manifest.cLanguageStandard, "iso9899:1994")
325+
XCTAssertEqual(manifest.cLanguageStandard, "iso9899:199409")
326326
XCTAssertEqual(manifest.cxxLanguageStandard, "gnu++14")
327327
}
328328
}

0 commit comments

Comments
 (0)