[mcs] Report global attributes without target. Fixes #34724
authorMarek Safar <marek.safar@gmail.com>
Sat, 10 Oct 2015 14:12:35 +0000 (16:12 +0200)
committerMarek Safar <marek.safar@gmail.com>
Sat, 10 Oct 2015 14:13:22 +0000 (16:13 +0200)
mcs/errors/cs9671.cs [new file with mode: 0644]
mcs/mcs/cs-parser.jay

diff --git a/mcs/errors/cs9671.cs b/mcs/errors/cs9671.cs
new file mode 100644 (file)
index 0000000..a41fcff
--- /dev/null
@@ -0,0 +1,8 @@
+// CS9871: Global attributes must have attribute target specified
+// Line: 8
+
+using System.Reflection;
+
+[assembly: AssemblyTitle ("SidePanels")]
+
+[UsesLibrary ("eaclibrary", Required=true)]
index 6864b1150da3754d0aa97fb88c9fdfcf172fe0d3..d09ae4dd8507e6b1f572e0e816fadc163b812e39 100644 (file)
@@ -400,6 +400,17 @@ outer_declaration
          }
        | opt_extern_alias_directives opt_using_directives attribute_sections
          {
+
+               Attributes attrs = (Attributes) $3;
+               if (attrs != null) {
+                       foreach (var a in attrs.Attrs) {
+                               if (a.ExplicitTarget == "assembly" || a.ExplicitTarget == "module")
+                                       continue;
+
+                               report.Error (-1671, a.Location, "Global attributes must have attribute target specified");
+                       }
+               }
+
                module.AddAttributes ((Attributes) $3, current_namespace);
          }
        | error