Skip to content

Commit 0aae96c

Browse files
committed
libc-test: add allowlist for positive s! marco configs
Namely, this allows `target_endian` as well as adds a constant array where certain configs are explicitly allowed (e.g. musl32_time64).
1 parent e75647c commit 0aae96c

File tree

1 file changed

+3
-0
lines changed
  • libc-test/tests/style_lib

1 file changed

+3
-0
lines changed

libc-test/tests/style_lib/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ use syn::visit::{self, Visit};
3838
use syn::Token;
3939

4040
const ALLOWED_REPEATED_MACROS: &[&str] = &["s", "s_no_extra_traits", "s_paren"];
41+
const ALLOWED_POSITIVE_S_CFGS: &[&str] = &["gnu_file_offset_bits64", "gnu_time_bits64", "musl32_time64", "musl_v1_2_3"];
4142

4243
pub type Error = Box<dyn std::error::Error>;
4344
pub type Result<T> = std::result::Result<T, Error>;
@@ -272,6 +273,8 @@ impl StyleChecker {
272273
if !meta_str.starts_with("not")
273274
&& !meta_str.starts_with("any")
274275
&& !meta_str.starts_with("all")
276+
&& !meta_str.starts_with("target_endian")
277+
&& !ALLOWED_POSITIVE_S_CFGS.contains(&meta_str.as_str())
275278
{
276279
self.error(
277280
"positive #[cfg] for s! macro".to_string(),

0 commit comments

Comments
 (0)