diff mbox series

[pushed] Darwin: Support '-ObjC{, ++}' as shorthand for -xobjective-c{, ++} [PR117478].

Message ID 20241109163313.47860-1-iain@sandoe.co.uk
State New
Headers show
Series [pushed] Darwin: Support '-ObjC{, ++}' as shorthand for -xobjective-c{, ++} [PR117478]. | expand

Commit Message

Iain Sandoe Nov. 9, 2024, 4:33 p.m. UTC
Tested on x86_64-darwin19, 21 and on x86_64-linux, pushed to trunk,
thanks,
Iain

--- 8< ---

This improves compatibility with clang, and is used by some projects.

	PR target/117478

gcc/ChangeLog:

	* config/darwin-driver.cc (darwin_driver_init): Handle ObjC/ObjC++
	* config/darwin.opt: Add ObjC/ObjC++ as driver-only options.

Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
 gcc/config/darwin-driver.cc | 10 ++++++++++
 gcc/config/darwin.opt       |  6 ++++++
 2 files changed, 16 insertions(+)
diff mbox series

Patch

diff --git a/gcc/config/darwin-driver.cc b/gcc/config/darwin-driver.cc
index 2aa0b0cd9e4..f2aa6be6eea 100644
--- a/gcc/config/darwin-driver.cc
+++ b/gcc/config/darwin-driver.cc
@@ -351,6 +351,16 @@  darwin_driver_init (unsigned int *decoded_options_count,
 	    noexport_p = false;
 	  break;
 
+	case OPT_ObjC:
+	  (*decoded_options)[i].opt_index = OPT_x;
+	  (*decoded_options)[i].arg = "objective-c";
+	  break;
+
+	case OPT_ObjC__:
+	  (*decoded_options)[i].opt_index = OPT_x;
+	  (*decoded_options)[i].arg = "objective-c++";
+	  break;
+
 	default:
 	  break;
 	}
diff --git a/gcc/config/darwin.opt b/gcc/config/darwin.opt
index 114048045b9..b105828551c 100644
--- a/gcc/config/darwin.opt
+++ b/gcc/config/darwin.opt
@@ -261,6 +261,12 @@  noseglinkedit
 Driver RejectNegative Negative(seglinkedit)
 (Obsolete) This is the default.
 
+ObjC
+Driver RejectNegative
+
+ObjC++
+Driver RejectNegative
+
 object
 Driver RejectNegative