]> git.ipfire.org Git - thirdparty/gcc.git/commit
gccrs: Emit error with proc macro on non functions
authorPierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Fri, 21 Jul 2023 10:41:12 +0000 (12:41 +0200)
committerArthur Cohen <arthur.cohen@embecosm.com>
Tue, 16 Jan 2024 17:56:00 +0000 (18:56 +0100)
commitcd90ba84e1725449c7ca0c3ff6ec4304c1504b9f
treecc4aa57a22f8caa6bed8f7763e8d23a128dbcae3
parent6050e07157ef915460a936452f29bd237f795e5f
gccrs: Emit error with proc macro on non functions

An error should be emitted when a proc_macro, proc_macro_attribute or
proc_macro_derive attribute is met on any non function item. Those
attribute shall be placed only on bare functions.

gcc/rust/ChangeLog:

* util/rust-attributes.cc (is_proc_macro_type): Add function to
identify matching proc macro attribute type.
(check_proc_macro_non_function): Add function to check and emit
error.
(AttributeChecker::visit): Add cal to new check function.

Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
gcc/rust/util/rust-attributes.cc