From a4b7ed7a42c716ab9f05e351f003d589124fd55d Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Wed, 17 Apr 2024 14:18:58 +0200 Subject: Adding upstream version 1.68.2+dfsg1. Signed-off-by: Daniel Baumann --- tests/ui/asm/inline-syntax.rs | 60 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 tests/ui/asm/inline-syntax.rs (limited to 'tests/ui/asm/inline-syntax.rs') diff --git a/tests/ui/asm/inline-syntax.rs b/tests/ui/asm/inline-syntax.rs new file mode 100644 index 000000000..d06796e33 --- /dev/null +++ b/tests/ui/asm/inline-syntax.rs @@ -0,0 +1,60 @@ +// revisions: x86_64 arm +//[x86_64] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64] check-pass +//[x86_64] needs-llvm-components: x86 +//[x86_64_allowed] compile-flags: --target x86_64-unknown-linux-gnu +//[x86_64_allowed] check-pass +//[x86_64_allowed] needs-llvm-components: x86 +//[arm] compile-flags: --target armv7-unknown-linux-gnueabihf +//[arm] build-fail +//[arm] needs-llvm-components: arm +// needs-asm-support + +#![feature(no_core, lang_items, rustc_attrs)] +#![crate_type = "rlib"] +#![no_core] +#![cfg_attr(x86_64_allowed, allow(bad_asm_style))] + +#[rustc_builtin_macro] +macro_rules! asm { + () => {}; +} +#[rustc_builtin_macro] +macro_rules! global_asm { + () => {}; +} + +#[lang = "sized"] +trait Sized {} + +pub fn main() { + unsafe { + asm!(".intel_syntax noprefix", "nop"); + //[x86_64]~^ WARN avoid using `.intel_syntax` + //[arm]~^^ ERROR unknown directive + asm!(".intel_syntax aaa noprefix", "nop"); + //[x86_64]~^ WARN avoid using `.intel_syntax` + //[arm]~^^ ERROR unknown directive + asm!(".att_syntax noprefix", "nop"); + //[x86_64]~^ WARN avoid using `.att_syntax` + //[arm]~^^ ERROR unknown directive + asm!(".att_syntax bbb noprefix", "nop"); + //[x86_64]~^ WARN avoid using `.att_syntax` + //[arm]~^^ ERROR unknown directive + asm!(".intel_syntax noprefix; nop"); + //[x86_64]~^ WARN avoid using `.intel_syntax` + //[arm]~^^ ERROR unknown directive + + asm!( + r" + .intel_syntax noprefix + nop" + ); + //[x86_64]~^^^ WARN avoid using `.intel_syntax` + //[arm]~^^^^ ERROR unknown directive + } +} + +global_asm!(".intel_syntax noprefix", "nop"); +//[x86_64]~^ WARN avoid using `.intel_syntax` +// Assembler errors don't have line numbers, so no error on ARM -- cgit v1.2.3