objc: Add support for per-location warning groups.
authorMartin Sebor <msebor@redhat.com>
Mon, 28 Jun 2021 21:13:17 +0000 (15:13 -0600)
committerMartin Sebor <msebor@redhat.com>
Mon, 28 Jun 2021 21:13:17 +0000 (15:13 -0600)
gcc/objc/ChangeLog:

* objc-act.c (objc_maybe_build_modify_expr): Replace direct uses
of TREE_NO_WARNING with warning_suppressed_p, and suppress_warning.
(objc_build_incr_expr_for_property_ref): Same.
(objc_build_struct): Same.
(synth_module_prologue): Same.
* objc-gnu-runtime-abi-01.c (gnu_runtime_01_initialize): Same.
* objc-next-runtime-abi-01.c (next_runtime_01_initialize): Same.
* objc-next-runtime-abi-02.c (next_runtime_02_initialize): Same.

gcc/objc/objc-act.c
gcc/objc/objc-gnu-runtime-abi-01.c
gcc/objc/objc-next-runtime-abi-01.c
gcc/objc/objc-next-runtime-abi-02.c

index 8d106a4..ec20891 100644 (file)
@@ -2007,7 +2007,7 @@ objc_maybe_build_modify_expr (tree lhs, tree rhs)
         correct (maybe a more sophisticated implementation could
         avoid generating the compound expression if not needed), but
         we need to turn it off.  */
-      TREE_NO_WARNING (compound_expr) = 1;
+      suppress_warning (compound_expr, OPT_Wunused);
       return compound_expr;
     }
   else
@@ -2129,7 +2129,7 @@ objc_build_incr_expr_for_property_ref (location_t location,
 
   /* Prevent C++ from warning with -Wall that "right operand of comma
      operator has no effect".  */
-  TREE_NO_WARNING (compound_expr) = 1;
+  suppress_warning (compound_expr, OPT_Wunused);
   return compound_expr;
 }
 
@@ -2262,8 +2262,9 @@ objc_build_struct (tree klass, tree fields, tree super_name)
       DECL_FIELD_IS_BASE (base) = 1;
 
       if (fields)
-       TREE_NO_WARNING (fields) = 1;   /* Suppress C++ ABI warnings -- we   */
-#endif                                 /* are following the ObjC ABI here.  */
+       /* Suppress C++ ABI warnings: we are following the ObjC ABI here.  */
+       suppress_warning (fields, OPT_Wabi);
+#endif
       DECL_CHAIN (base) = fields;
       fields = base;
     }
@@ -3112,19 +3113,19 @@ synth_module_prologue (void)
                                                TYPE_DECL,
                                                objc_object_name,
                                                objc_object_type));
-  TREE_NO_WARNING (type) = 1;
+  suppress_warning (type);
 
   type = lang_hooks.decls.pushdecl (build_decl (input_location,
                                                TYPE_DECL,
                                                objc_instancetype_name,
                                                objc_instancetype_type));
-  TREE_NO_WARNING (type) = 1;
+  suppress_warning (type);
 
   type = lang_hooks.decls.pushdecl (build_decl (input_location,
                                                TYPE_DECL,
                                                objc_class_name,
                                                objc_class_type));
-  TREE_NO_WARNING (type) = 1;
+  suppress_warning (type);
 
   /* Forward-declare '@interface Protocol'.  */
   type = get_identifier (PROTOCOL_OBJECT_CLASS_NAME);
index 4add71e..976fa1e 100644 (file)
@@ -213,7 +213,7 @@ static void gnu_runtime_01_initialize (void)
                                                TYPE_DECL,
                                                objc_selector_name,
                                                objc_selector_type));
-  TREE_NO_WARNING (type) = 1;
+  suppress_warning (type);
 
   /* typedef id (*IMP)(id, SEL, ...); */
   ftype = build_varargs_function_type_list (objc_object_type,
index 3ec6e17..183fc01 100644 (file)
@@ -282,7 +282,7 @@ static void next_runtime_01_initialize (void)
                                                TYPE_DECL,
                                                objc_selector_name,
                                                objc_selector_type));
-  TREE_NO_WARNING (type) = 1;
+  suppress_warning (type);
 
   build_v1_class_template ();
   build_super_template ();
index 3cfcd0b..963d1bf 100644 (file)
@@ -379,7 +379,7 @@ static void next_runtime_02_initialize (void)
                                                TYPE_DECL,
                                                objc_selector_name,
                                                objc_selector_type));
-  TREE_NO_WARNING (type) = 1;
+  suppress_warning (type);
 
   /* IMP : id (*) (id, _message_ref_t*, ...)
      SUPER_IMP : id (*) ( super_t*, _super_message_ref_t*, ...)