@@ -203,6 +203,92 @@ public struct CSetting: Sendable {
203203 public static func unsafeFlags( _ flags: [ String ] , _ condition: BuildSettingCondition ? = nil ) -> CSetting {
204204 return CSetting ( name: " unsafeFlags " , value: flags, condition: condition)
205205 }
206+
207+ /// Controls how all C compiler warnings are treated during compilation.
208+ ///
209+ /// Use this setting to specify whether all warnings should be treated as warnings (default behavior)
210+ /// or as errors. This is equivalent to passing `-Werror` or `-Wno-error`
211+ /// to the C compiler.
212+ ///
213+ /// This setting applies to all warnings emitted by the C compiler. To control specific
214+ /// warnings individually, use `treatWarning(name:as:_:)` instead.
215+ ///
216+ /// - Since: First available in PackageDescription 6.2.
217+ ///
218+ /// - Parameters:
219+ /// - level: The treatment level for all warnings (`.warning` or `.error`).
220+ /// - condition: A condition that restricts the application of the build setting.
221+ @available ( _PackageDescription, introduced: 6.2 )
222+ public static func treatAllWarnings(
223+ as level: WarningLevel ,
224+ _ condition: BuildSettingCondition ? = nil
225+ ) -> CSetting {
226+ return CSetting (
227+ name: " treatAllWarnings " , value: [ level. rawValue] , condition: condition)
228+ }
229+
230+ /// Controls how a specific C compiler warning is treated during compilation.
231+ ///
232+ /// Use this setting to specify whether a particular warning should be treated as a warning
233+ /// (default behavior) or as an error. This is equivalent to passing `-Werror=` or `-Wno-error=`
234+ /// followed by the warning name to the C compiler.
235+ ///
236+ /// This setting allows for fine-grained control over individual warnings. To control all
237+ /// warnings at once, use `treatAllWarnings(as:_:)` instead.
238+ ///
239+ /// - Since: First available in PackageDescription 6.2.
240+ ///
241+ /// - Parameters:
242+ /// - name: The name of the specific warning to control.
243+ /// - level: The treatment level for the warning (`.warning` or `.error`).
244+ /// - condition: A condition that restricts the application of the build setting.
245+ @available ( _PackageDescription, introduced: 6.2 )
246+ public static func treatWarning(
247+ _ name: String ,
248+ as level: WarningLevel ,
249+ _ condition: BuildSettingCondition ? = nil
250+ ) -> CSetting {
251+ return CSetting (
252+ name: " treatWarning " , value: [ name, level. rawValue] , condition: condition)
253+ }
254+
255+ /// Enable a specific C compiler warning group.
256+ ///
257+ /// Use this setting to enable a specific warning group. This is equivalent to passing
258+ /// `-W` followed by the group name to the C compiler.
259+ ///
260+ /// - Since: First available in PackageDescription 6.2.
261+ ///
262+ /// - Parameters:
263+ /// - name: The name of the warning group to enable.
264+ /// - condition: A condition that restricts the application of the build setting.
265+ @available ( _PackageDescription, introduced: 6.2 )
266+ public static func enableWarning(
267+ _ name: String ,
268+ _ condition: BuildSettingCondition ? = nil
269+ ) -> CSetting {
270+ return CSetting (
271+ name: " enableWarning " , value: [ name] , condition: condition)
272+ }
273+
274+ /// Disable a specific C compiler warning group.
275+ ///
276+ /// Use this setting to disable a specific warning group. This is equivalent to passing
277+ /// `-Wno-` followed by the group name to the C compiler.
278+ ///
279+ /// - Since: First available in PackageDescription 6.2.
280+ ///
281+ /// - Parameters:
282+ /// - name: The name of the warning group to disable.
283+ /// - condition: A condition that restricts the application of the build setting.
284+ @available ( _PackageDescription, introduced: 6.2 )
285+ public static func disableWarning(
286+ _ name: String ,
287+ _ condition: BuildSettingCondition ? = nil
288+ ) -> CSetting {
289+ return CSetting (
290+ name: " disableWarning " , value: [ name] , condition: condition)
291+ }
206292}
207293
208294/// A CXX-language build setting.
@@ -273,6 +359,92 @@ public struct CXXSetting: Sendable {
273359 public static func unsafeFlags( _ flags: [ String ] , _ condition: BuildSettingCondition ? = nil ) -> CXXSetting {
274360 return CXXSetting ( name: " unsafeFlags " , value: flags, condition: condition)
275361 }
362+
363+ /// Controls how all C++ compiler warnings are treated during compilation.
364+ ///
365+ /// Use this setting to specify whether all warnings should be treated as warnings (default behavior)
366+ /// or as errors. This is equivalent to passing `-Werror` or `-Wno-error`
367+ /// to the C++ compiler.
368+ ///
369+ /// This setting applies to all warnings emitted by the C++ compiler. To control specific
370+ /// warnings individually, use `treatWarning(name:as:_:)` instead.
371+ ///
372+ /// - Since: First available in PackageDescription 6.2.
373+ ///
374+ /// - Parameters:
375+ /// - level: The treatment level for all warnings (`.warning` or `.error`).
376+ /// - condition: A condition that restricts the application of the build setting.
377+ @available ( _PackageDescription, introduced: 6.2 )
378+ public static func treatAllWarnings(
379+ as level: WarningLevel ,
380+ _ condition: BuildSettingCondition ? = nil
381+ ) -> CXXSetting {
382+ return CXXSetting (
383+ name: " treatAllWarnings " , value: [ level. rawValue] , condition: condition)
384+ }
385+
386+ /// Controls how a specific C++ compiler warning is treated during compilation.
387+ ///
388+ /// Use this setting to specify whether a particular warning should be treated as a warning
389+ /// (default behavior) or as an error. This is equivalent to passing `-Werror=` or `-Wno-error=`
390+ /// followed by the warning name to the C++ compiler.
391+ ///
392+ /// This setting allows for fine-grained control over individual warnings. To control all
393+ /// warnings at once, use `treatAllWarnings(as:_:)` instead.
394+ ///
395+ /// - Since: First available in PackageDescription 6.2.
396+ ///
397+ /// - Parameters:
398+ /// - name: The name of the specific warning to control.
399+ /// - level: The treatment level for the warning (`.warning` or `.error`).
400+ /// - condition: A condition that restricts the application of the build setting.
401+ @available ( _PackageDescription, introduced: 6.2 )
402+ public static func treatWarning(
403+ _ name: String ,
404+ as level: WarningLevel ,
405+ _ condition: BuildSettingCondition ? = nil
406+ ) -> CXXSetting {
407+ return CXXSetting (
408+ name: " treatWarning " , value: [ name, level. rawValue] , condition: condition)
409+ }
410+
411+ /// Enable a specific C++ compiler warning group.
412+ ///
413+ /// Use this setting to enable a specific warning group. This is equivalent to passing
414+ /// `-W` followed by the group name to the C++ compiler.
415+ ///
416+ /// - Since: First available in PackageDescription 6.2.
417+ ///
418+ /// - Parameters:
419+ /// - name: The name of the warning group to enable.
420+ /// - condition: A condition that restricts the application of the build setting.
421+ @available ( _PackageDescription, introduced: 6.2 )
422+ public static func enableWarning(
423+ _ name: String ,
424+ _ condition: BuildSettingCondition ? = nil
425+ ) -> CXXSetting {
426+ return CXXSetting (
427+ name: " enableWarning " , value: [ name] , condition: condition)
428+ }
429+
430+ /// Disable a specific C++ compiler warning group.
431+ ///
432+ /// Use this setting to disable a specific warning group. This is equivalent to passing
433+ /// `-Wno-` followed by the group name to the C++ compiler.
434+ ///
435+ /// - Since: First available in PackageDescription 6.2.
436+ ///
437+ /// - Parameters:
438+ /// - name: The name of the warning group to disable.
439+ /// - condition: A condition that restricts the application of the build setting.
440+ @available ( _PackageDescription, introduced: 6.2 )
441+ public static func disableWarning(
442+ _ name: String ,
443+ _ condition: BuildSettingCondition ? = nil
444+ ) -> CXXSetting {
445+ return CXXSetting (
446+ name: " disableWarning " , value: [ name] , condition: condition)
447+ }
276448}
277449
278450/// A Swift language build setting.
@@ -465,6 +637,54 @@ public struct SwiftSetting: Sendable {
465637 name: " swiftLanguageMode " , value: [ . init( describing: mode) ] , condition: condition)
466638 }
467639
640+ /// Controls how all Swift compiler warnings are treated during compilation.
641+ ///
642+ /// Use this setting to specify whether all warnings should be treated as warnings (default behavior)
643+ /// or as errors. This is equivalent to passing `-warnings-as-errors` or `-no-warnings-as-errors`
644+ /// to the Swift compiler.
645+ ///
646+ /// This setting applies to all warnings emitted by the Swift compiler. To control specific
647+ /// warnings individually, use `treatWarning(name:as:_:)` instead.
648+ ///
649+ /// - Since: First available in PackageDescription 6.2.
650+ ///
651+ /// - Parameters:
652+ /// - level: The treatment level for all warnings (`.warning` or `.error`).
653+ /// - condition: A condition that restricts the application of the build setting.
654+ @available ( _PackageDescription, introduced: 6.2 )
655+ public static func treatAllWarnings(
656+ as level: WarningLevel ,
657+ _ condition: BuildSettingCondition ? = nil
658+ ) -> SwiftSetting {
659+ return SwiftSetting (
660+ name: " treatAllWarnings " , value: [ level. rawValue] , condition: condition)
661+ }
662+
663+ /// Controls how a specific Swift compiler warning is treated during compilation.
664+ ///
665+ /// Use this setting to specify whether a particular warning should be treated as a warning
666+ /// (default behavior) or as an error. This is equivalent to passing `-Werror` or `-Wwarning`
667+ /// followed by the warning name to the Swift compiler.
668+ ///
669+ /// This setting allows for fine-grained control over individual warnings. To control all
670+ /// warnings at once, use `treatAllWarnings(as:_:)` instead.
671+ ///
672+ /// - Since: First available in PackageDescription 6.2.
673+ ///
674+ /// - Parameters:
675+ /// - name: The name of the specific warning to control.
676+ /// - level: The treatment level for the warning (`.warning` or `.error`).
677+ /// - condition: A condition that restricts the application of the build setting.
678+ @available ( _PackageDescription, introduced: 6.2 )
679+ public static func treatWarning(
680+ _ name: String ,
681+ as level: WarningLevel ,
682+ _ condition: BuildSettingCondition ? = nil
683+ ) -> SwiftSetting {
684+ return SwiftSetting (
685+ name: " treatWarning " , value: [ name, level. rawValue] , condition: condition)
686+ }
687+
468688 /// Set the default isolation to the given global actor type.
469689 ///
470690 /// - Since: First available in PackageDescription 6.2.
0 commit comments