The attached patch replaces the uses of TREE_NO_WARNING in the Objective-C front end.
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 get_no_warning, and set_no_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. diff --git a/gcc/objc/objc-act.c b/gcc/objc/objc-act.c index 796256d437e..a4154709b00 100644 --- a/gcc/objc/objc-act.c +++ b/gcc/objc/objc-act.c @@ -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; + set_no_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; + set_no_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. */ + set_no_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; + set_no_warning (type); type = lang_hooks.decls.pushdecl (build_decl (input_location, TYPE_DECL, objc_instancetype_name, objc_instancetype_type)); - TREE_NO_WARNING (type) = 1; + set_no_warning (type); type = lang_hooks.decls.pushdecl (build_decl (input_location, TYPE_DECL, objc_class_name, objc_class_type)); - TREE_NO_WARNING (type) = 1; + set_no_warning (type); /* Forward-declare '@interface Protocol'. */ type = get_identifier (PROTOCOL_OBJECT_CLASS_NAME); diff --git a/gcc/objc/objc-gnu-runtime-abi-01.c b/gcc/objc/objc-gnu-runtime-abi-01.c index 4add71edf41..9a63bbf45fd 100644 --- a/gcc/objc/objc-gnu-runtime-abi-01.c +++ b/gcc/objc/objc-gnu-runtime-abi-01.c @@ -213,7 +213,7 @@ static void gnu_runtime_01_initialize (void) TYPE_DECL, objc_selector_name, objc_selector_type)); - TREE_NO_WARNING (type) = 1; + set_no_warning (type); /* typedef id (*IMP)(id, SEL, ...); */ ftype = build_varargs_function_type_list (objc_object_type, diff --git a/gcc/objc/objc-next-runtime-abi-01.c b/gcc/objc/objc-next-runtime-abi-01.c index 3ec6e1703c1..b58e4829674 100644 --- a/gcc/objc/objc-next-runtime-abi-01.c +++ b/gcc/objc/objc-next-runtime-abi-01.c @@ -282,7 +282,7 @@ static void next_runtime_01_initialize (void) TYPE_DECL, objc_selector_name, objc_selector_type)); - TREE_NO_WARNING (type) = 1; + set_no_warning (type); build_v1_class_template (); build_super_template (); diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c index 3cfcd0b1a57..22266c6e612 100644 --- a/gcc/objc/objc-next-runtime-abi-02.c +++ b/gcc/objc/objc-next-runtime-abi-02.c @@ -379,7 +379,7 @@ static void next_runtime_02_initialize (void) TYPE_DECL, objc_selector_name, objc_selector_type)); - TREE_NO_WARNING (type) = 1; + set_no_warning (type); /* IMP : id (*) (id, _message_ref_t*, ...) SUPER_IMP : id (*) ( super_t*, _super_message_ref_t*, ...)