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

make defmt attributes forward input attributes #293

Merged
merged 6 commits into from
Dec 15, 2020
Merged

make defmt attributes forward input attributes #293

merged 6 commits into from
Dec 15, 2020

Conversation

japaric
Copy link
Member

@japaric japaric commented Nov 30, 2020

work towards fixing #252

  • reject {panic_handler,timestamp} + ( #[export_name] OR #[no_mangle])

(I was expecting #[timestamp] #[inline(always)] fn foo() -> u64 { 0 } to fail at link time but it works ... perhaps export_name undoes inlining?)

@@ -95,8 +121,13 @@ pub fn panic_handler(args: TokenStream, input: TokenStream) -> TokenStream {
.into();
}

let attrs = &f.attrs;
if let Err(e) = reject_attributes("panic_handler", attrs, &["export_name", "no_mangle"]) {
Copy link
Contributor

Choose a reason for hiding this comment

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

imo possible attribute clashes should be documented in https://defmt.ferrous-systems.com/panic.html?highlight=panic_han#defmtpanic_handler

Copy link
Member Author

Choose a reason for hiding this comment

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

good call

};

fn reject_attributes(
Copy link
Contributor

Choose a reason for hiding this comment

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

could you add a short description of what this function does?

(nit: the function name is a bit misleading, I would've found something like check_attribute_conflict more helpful but that's really splitting hairs.)

@japaric
Copy link
Member Author

japaric commented Dec 15, 2020

bors r+

@japaric
Copy link
Member Author

japaric commented Dec 15, 2020

bors r-

@bors
Copy link
Contributor

bors bot commented Dec 15, 2020

Canceled.

@japaric
Copy link
Member Author

japaric commented Dec 15, 2020

bors r=Lotterleben

@bors
Copy link
Contributor

bors bot commented Dec 15, 2020

Build succeeded:

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