Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppress some warnings #421

Merged
merged 1 commit into from
May 31, 2021
Merged

Suppress some warnings #421

merged 1 commit into from
May 31, 2021

Conversation

JohnTitor
Copy link
Member

Found some warnings when checking a libc CI log.

  • We use #![allow(unused_imports)] for most modules but arm doesn't have.
  • {memcpy,memmove,memset}_element_unordered_atomic emits a dead_code warning when atomic is disabled (e.g. riscv32i-unknown-none-elf)

src/mem/mod.rs Outdated
@@ -69,6 +69,7 @@ pub unsafe extern "C" fn bcmp(s1: *const u8, s2: *const u8, n: usize) -> i32 {
}

// `bytes` must be a multiple of `mem::size_of::<T>()`
#[cfg_attr(target_has_atomic_load_store = "0", allow(dead_code))]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this actually works? We never generate "0" as a value for target_has_atomic_load_store.

Also memcpy_element_unordered_atomic should almost always be supported. It is a bug with the riscv target if it doesn't expose the proper target_has_atomic_load_store attributes.

On RISC-V normal loads and stores are guaranteed to be atomic, even if the A extension is not supported. It's just that RMW operations are not available.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, I thought this (rust-lang/rust#66548) created target_has_atomic_load_store = "0". Then does just #[allow(dead_code)] work here?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, the RISC-V LLVM target behaves differently from the ARM one in this regards. In any case, you should be able to just change the condition to not(target_has_atomic_load_store = "8").

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated it, thanks!

@Amanieu Amanieu merged commit 612ddf8 into rust-lang:master May 31, 2021
@JohnTitor JohnTitor deleted the unused-import branch May 31, 2021 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants