diff mbox series

[pushed] Objective-C/C++ : Allow visibility prefix attributes on interfaces.

Message ID 3CCF74AB-E3F7-421D-86DB-0A19DC0A7063@sandoe.co.uk
State New
Headers show
Series [pushed] Objective-C/C++ : Allow visibility prefix attributes on interfaces. | expand

Commit Message

Iain Sandoe Nov. 6, 2020, 8:01 p.m. UTC
Hi,

Some system headers apply visibility attributes to Objective-C
@interface declarations.  Those are “default”, but still need to be
accepted.

tested across the Darwin patch and on x86_64-linux-gnu,
pushed to master,
thanks
Iain

-----

This passes visibility through without warning (so that, for example,
__attribute__((__visibility("default"))) does not result in any
diagnostic).

gcc/objc/ChangeLog:

	* objc-act.c (start_class): Accept visibility attributes
	without warning.
---
 gcc/objc/objc-act.c | 6 ++++--
 1 file changed, 4 insertions(+), 2 deletions(-)
diff mbox series

Patch

diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c
index 26cdeddfc5a..68d829fd773 100644
--- a/gcc/objc/objc-act.c
+++ b/gcc/objc/objc-act.c
@@ -7013,12 +7013,14 @@  start_class (enum tree_code code, tree class_name, tree super_name,
 	      tree name = TREE_PURPOSE (attribute);
 
 	      /* TODO: Document what the objc_exception attribute is/does.  */
-	      /* We handle the 'deprecated' and (undocumented) 'objc_exception'
-		 attributes.  */
+	      /* We handle the 'deprecated', 'visibility' and (undocumented)
+		 'objc_exception' attributes.  */
 	      if (is_attribute_p  ("deprecated", name))
 		TREE_DEPRECATED (klass) = 1;
 	      else if (is_attribute_p  ("objc_exception", name))
 		CLASS_HAS_EXCEPTION_ATTR (klass) = 1;
+	      else if (is_attribute_p  ("visibility", name))
+		;
 	      else
 		/* Warn about and ignore all others for now, but store them.  */
 		warning (OPT_Wattributes, "%qE attribute directive ignored", name);