Skip to content

Commit 3241ec5

Browse files
committed
Do not deny warnings by default.
libc currently denies all warnings by default. This commit denies warnings only when libc is built in CI.
1 parent dab1050 commit 3241ec5

File tree

3 files changed

+11
-5
lines changed

3 files changed

+11
-5
lines changed

build.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ fn main() {
77
rustc_minor_version().expect("Failed to get rustc version");
88
let rustc_dep_of_std = env::var("CARGO_FEATURE_RUSTC_DEP_OF_STD").is_ok();
99
let align_cargo_feature = env::var("CARGO_FEATURE_ALIGN").is_ok();
10-
#[allow(unused)]
1110
let libc_ci = env::var("LIBC_CI").is_ok();
1211

1312
if env::var("CARGO_FEATURE_USE_STD").is_ok() {
@@ -28,6 +27,11 @@ fn main() {
2827
Some(_) | None => println!("cargo:rustc-cfg=freebsd11"),
2928
}
3029

30+
// On CI: deny all warnings
31+
if libc_ci {
32+
println!("cargo:rustc-cfg=libc_deny_warnings");
33+
}
34+
3135
// Rust >= 1.15 supports private module use:
3236
if rustc_minor_ver >= 15 || rustc_dep_of_std {
3337
println!("cargo:rustc-cfg=libc_priv_mod_use");

ci/azure.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ jobs:
136136
- template: azure-install-rust.yml
137137
- script: sh ci/style.sh
138138
displayName: Check style
139-
- script: sh ci/dox.sh
139+
- script: LIBC_CI=1 sh ci/dox.sh
140140
displayName: Generate documentation
141141
- template: azure-configs/static-websites.yml@rustinfra
142142
parameters:
@@ -169,7 +169,7 @@ jobs:
169169
vmImage: ubuntu-16.04
170170
steps:
171171
- template: azure-install-rust.yml
172-
- script: sh ./ci/build.sh
172+
- script: LIBC_CI=1 sh ./ci/build.sh
173173
displayName: Execute build.sh
174174
strategy:
175175
matrix:
@@ -198,7 +198,7 @@ jobs:
198198
vmImage: macos-10.13
199199
steps:
200200
- template: azure-install-rust.yml
201-
- script: sh ./ci/build.sh
201+
- script: LIBC_CI=1 sh ./ci/build.sh
202202
displayName: Execute build.sh
203203
strategy:
204204
matrix:

src/lib.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,10 @@
1414
//! [pd]: https://rust-lang.github.io/libc/#platform-specific-documentation
1515
#![crate_name = "libc"]
1616
#![crate_type = "rlib"]
17-
#![cfg_attr(not(feature = "rustc-dep-of-std"), deny(warnings))]
17+
#![cfg_attr(libc_deny_warnings, deny(warnings))]
1818
#![allow(bad_style, overflowing_literals, improper_ctypes, unknown_lints)]
19+
// FIXME: this is due to a rustc bug
20+
#![allow(redundant_semicolon)]
1921
// Attributes needed when building as part of the standard library
2022
#![cfg_attr(
2123
feature = "rustc-dep-of-std",

0 commit comments

Comments
 (0)