<!--
{
  "availability" : [
    "SwiftPM: 6.2.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "PackageDescription",
  "identifier" : "/documentation/PackageDescription/CSetting/treatAllWarnings(as:_:)",
  "metadataVersion" : "0.1.0",
  "role" : "Type Method",
  "symbol" : {
    "kind" : "Type Method",
    "modules" : [
      "PackageDescription"
    ],
    "preciseIdentifier" : "s:18PackageDescription8CSettingV16treatAllWarnings2as_AcA12WarningLevelO_AA21BuildSettingConditionVSgtFZ"
  },
  "title" : "treatAllWarnings(as:_:)"
}
-->

# treatAllWarnings(as:_:)

Controls how all C compiler warnings are treated during compilation.

```
static func treatAllWarnings(as level: WarningLevel, _ condition: BuildSettingCondition? = nil) -> CSetting
```

## Parameters

`level`

The treatment level for all warnings (`.warning` or `.error`).

`condition`

A condition that restricts the application of the build setting.

## Discussion

Use this setting to specify whether all warnings should be treated as warnings (default behavior)
or as errors. This is equivalent to passing `-Werror` or `-Wno-error`
to the C compiler.

This setting applies to all warnings emitted by the C compiler. To control specific
warnings individually, use `treatWarning(name:as:_:)` instead.

> Since: First available in PackageDescription 6.2.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)