public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc r14-7806] gccrs: proc macro: Detect malformed proc_macro_derive
@ 2024-01-16 18:00 Arthur Cohen
  0 siblings, 0 replies; only message in thread
From: Arthur Cohen @ 2024-01-16 18:00 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:1b1f8d898857b69b98095fc26b4dd95bafffdc18

commit r14-7806-g1b1f8d898857b69b98095fc26b4dd95bafffdc18
Author: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>
Date:   Tue Jul 18 13:37:03 2023 +0200

    gccrs: proc macro: Detect malformed proc_macro_derive
    
    A derive procedural macro declaration shall always have at least a trait
    to refer to. We should error out when it doesn't.
    
    gcc/rust/ChangeLog:
    
            * util/rust-attributes.cc (AttributeChecker::visit): Add
            attribute input check.
    
    Signed-off-by: Pierre-Emmanuel Patry <pierre-emmanuel.patry@embecosm.com>

Diff:
---
 gcc/rust/util/rust-attributes.cc | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/gcc/rust/util/rust-attributes.cc b/gcc/rust/util/rust-attributes.cc
index a174edc625f..c8451def94e 100644
--- a/gcc/rust/util/rust-attributes.cc
+++ b/gcc/rust/util/rust-attributes.cc
@@ -561,6 +561,11 @@ AttributeChecker::visit (AST::Function &fun)
 
       if (result.name == "proc_macro_derive")
 	{
+	  if (!attribute.has_attr_input ())
+	    {
+	      rust_error_at (attribute.get_locus (),
+			     "malformed %<%s%> attribute input", name);
+	    }
 	  check_crate_type (name, attribute);
 	}
       else if (result.name == "proc_macro"

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2024-01-16 18:00 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-16 18:00 [gcc r14-7806] gccrs: proc macro: Detect malformed proc_macro_derive Arthur Cohen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).