Skip to content

Commit ad95886

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 3a3e9af commit ad95886

File tree

1 file changed

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

1 file changed

+8
-0
lines changed

libc-test/tests/style_lib/mod.rs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,12 @@ use syn::visit::{
5151
use syn::Token;
5252

5353
const ALLOWED_REPEATED_MACROS: &[&str] = &["s", "s_no_extra_traits", "s_paren"];
54+
const ALLOWED_POSITIVE_S_CFGS: &[&str] = &[
55+
"gnu_file_offset_bits64",
56+
"gnu_time_bits64",
57+
"musl32_time64",
58+
"musl_v1_2_3",
59+
];
5460

5561
pub type Error = Box<dyn std::error::Error>;
5662
pub type Result<T> = std::result::Result<T, Error>;
@@ -285,6 +291,8 @@ impl StyleChecker {
285291
if !meta_str.starts_with("not")
286292
&& !meta_str.starts_with("any")
287293
&& !meta_str.starts_with("all")
294+
&& !meta_str.starts_with("target_endian")
295+
&& !ALLOWED_POSITIVE_S_CFGS.contains(&meta_str.as_str())
288296
{
289297
self.error(
290298
"positive #[cfg] for s! macro".to_string(),

0 commit comments

Comments
 (0)