public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* Reject dllimport on scalar typedefs (bug 33963)
@ 2008-02-26 17:25 Joseph S. Myers
  2008-02-26 21:51 ` Mark Mitchell
  0 siblings, 1 reply; 8+ messages in thread
From: Joseph S. Myers @ 2008-02-26 17:25 UTC (permalink / raw)
  To: gcc-patches

Bug 33963 is a regression in 4.3 and later where dllimport and
dllexport attributes are wrongly accepted on scalar types.

This patch fixes this bug.  Tested with no regressions with cross to
i686-mingw32, where it fixes:

FAIL: gcc.dg/attr-invalid.c  (test for warnings, line 88)
FAIL: gcc.dg/attr-invalid.c  (test for warnings, line 90)

OK to commit?  (If OK, I'll also commit to 4.3 branch after 4.3.0 is
released.)

2008-02-26  Joseph Myers  <joseph@codesourcery.com>

	PR target/33963
	* tree.c (handle_dll_attribute): Disallow TYPE_DECLs for types
	other than structures and unions.

Index: gcc/tree.c
===================================================================
--- gcc/tree.c	(revision 132664)
+++ gcc/tree.c	(working copy)
@@ -4067,6 +4067,16 @@
       return NULL_TREE;
     }
 
+  if (TREE_CODE (node) == TYPE_DECL
+      && TREE_CODE (TREE_TYPE (node)) != RECORD_TYPE
+      && TREE_CODE (TREE_TYPE (node)) != UNION_TYPE)
+    {
+      *no_add_attrs = true;
+      warning (OPT_Wattributes, "%qs attribute ignored",
+	       IDENTIFIER_POINTER (name));
+      return NULL_TREE;
+    }
+
   /* Report error on dllimport ambiguities seen now before they cause
      any damage.  */
   else if (is_attribute_p ("dllimport", name))

-- 
Joseph S. Myers
joseph@codesourcery.com

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2008-02-28  7:31 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-26 17:25 Reject dllimport on scalar typedefs (bug 33963) Joseph S. Myers
2008-02-26 21:51 ` Mark Mitchell
2008-02-27  7:36   ` Danny Smith
2008-02-27 14:40     ` Joseph S. Myers
2008-02-27 17:30       ` Mark Mitchell
2008-02-28  7:12         ` Joseph S. Myers
2008-02-28  9:39           ` Mark Mitchell
2008-02-28  9:57             ` Danny Smith

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).