aboutsummaryrefslogtreecommitdiff
path: root/cortex-m-rt/macros/src
diff options
context:
space:
mode:
authorGravatar Emil Fresk <emil.fresk@gmail.com> 2020-01-16 17:59:54 +0100
committerGravatar Emil Fresk <emil.fresk@gmail.com> 2020-01-16 17:59:54 +0100
commit3dd900d8ad7c66fc2044e12e3d55274a5afb43a1 (patch)
tree26c63c17a47a4df618954115c7de24afc1012d09 /cortex-m-rt/macros/src
parent6c0464c63b08dcd9cb61b07c67c86d884a34b11d (diff)
downloadcortex-m-3dd900d8ad7c66fc2044e12e3d55274a5afb43a1.tar.gz
cortex-m-3dd900d8ad7c66fc2044e12e3d55274a5afb43a1.tar.zst
cortex-m-3dd900d8ad7c66fc2044e12e3d55274a5afb43a1.zip
Updated to not need blacklist
Diffstat (limited to 'cortex-m-rt/macros/src')
-rw-r--r--cortex-m-rt/macros/src/lib.rs42
1 files changed, 14 insertions, 28 deletions
diff --git a/cortex-m-rt/macros/src/lib.rs b/cortex-m-rt/macros/src/lib.rs
index 5d0ab55..d919faa 100644
--- a/cortex-m-rt/macros/src/lib.rs
+++ b/cortex-m-rt/macros/src/lib.rs
@@ -844,7 +844,6 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
"forbid",
"cold",
];
- let cortex_m_rt_blacklist = &["entry", "exception", "interrupt", "pre_init"];
'o: for attr in attrs {
for val in whitelist {
@@ -853,35 +852,22 @@ fn check_attr_whitelist(attrs: &[Attribute], caller: WhiteListCaller) -> Result<
}
}
- for val in cortex_m_rt_blacklist {
- if eq(&attr, &val) {
- let err_str = match caller {
- WhiteListCaller::Entry => {
- &"this attribute is not allowed on a cortex-m-rt entry point"
- }
- WhiteListCaller::Exception => {
- &"this attribute is not allowed on an exception handler"
- }
- WhiteListCaller::Interrupt => {
- &"this attribute is not allowed on an interrupt handler"
- }
- WhiteListCaller::PreInit => {
- &"this attribute is not allowed on an interrupt handler"
- }
- };
-
- return Err(parse::Error::new(attr.span(), err_str)
- .to_compile_error()
- .into());
+ let err_str = match caller {
+ WhiteListCaller::Entry => "this attribute is not allowed on a cortex-m-rt entry point",
+ WhiteListCaller::Exception => {
+ "this attribute is not allowed on an exception handler controlled by cortex-m-rt"
}
- }
+ WhiteListCaller::Interrupt => {
+ "this attribute is not allowed on an interrupt handler controlled by cortex-m-rt"
+ }
+ WhiteListCaller::PreInit => {
+ "this attribute is not allowed on a pre-init controlled by cortex-m-rt"
+ }
+ };
- return Err(parse::Error::new(
- attr.span(),
- "this attribute is not allowed on a function controlled by cortex-m-rt",
- )
- .to_compile_error()
- .into());
+ return Err(parse::Error::new(attr.span(), &err_str)
+ .to_compile_error()
+ .into());
}
Ok(())