objc: Add support for per-location warning groups.

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.
This commit is contained in:
Martin Sebor 2021-06-28 15:13:17 -06:00
parent 3f44889076
commit ed94172c7e
4 changed files with 11 additions and 10 deletions

View 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);

View 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,

View 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 ();

View 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*, ...)