diff mbox series

[pushed] Objective-C, NeXT runtime: Correct the default for fobjc-nilcheck.

Message ID DFDC6E14-5798-4E71-8B90-264A04922D1A@sandoe.co.uk
State New
Headers show
Series [pushed] Objective-C, NeXT runtime: Correct the default for fobjc-nilcheck. | expand

Commit Message

Iain Sandoe Aug. 19, 2021, 6:41 p.m. UTC
Hi,

It is intended that the default for the NeXT runtime at ABI 2 is to
check for nil message receivers.  This updates this to match the
documented behaviour and to match the behaviour of the system tools.

tested on x86_64, i686-darwin, x86_64-linux,
pushed to master, thanks
Iain

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>

gcc/objc/ChangeLog:

	* objc-next-runtime-abi-02.c (objc_next_runtime_abi_02_init):
	Default receiver nilchecks on.
---
 gcc/objc/objc-next-runtime-abi-02.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/gcc/objc/objc-next-runtime-abi-02.c b/gcc/objc/objc-next-runtime-abi-02.c
index 0d963e357c4..ce831fc34ae 100644
--- a/gcc/objc/objc-next-runtime-abi-02.c
+++ b/gcc/objc/objc-next-runtime-abi-02.c
@@ -254,6 +254,10 @@  objc_next_runtime_abi_02_init (objc_runtime_hooks *rthooks)
       flag_objc_sjlj_exceptions = 0;
     }
 
+  /* NeXT ABI 2 is intended to default to checking for nil receivers.  */
+  if (! global_options_set.x_flag_objc_nilcheck)
+    flag_objc_nilcheck = 1;
+
   rthooks->initialize = next_runtime_02_initialize;
   rthooks->default_constant_string_class_name = DEF_CONSTANT_STRING_CLASS_NAME;
   rthooks->tag_getclass = TAG_GETCLASS;