c-common.c (cb_register_builds): Define __NEXT_RUNTIME__ for ObjC with -fnext-runtime.
authorStan Shebs <shebs@apple.com>
Fri, 16 Aug 2002 23:31:06 +0000 (23:31 +0000)
committerStan Shebs <shebs@gcc.gnu.org>
Fri, 16 Aug 2002 23:31:06 +0000 (23:31 +0000)
* c-common.c (cb_register_builds): Define __NEXT_RUNTIME__
for ObjC with -fnext-runtime.
* doc/cpp.texi: Document it.

* objc/execute/selector-1.m: Add __NEXT_RUNTIME__ case.

From-SVN: r56390

gcc/ChangeLog
gcc/c-common.c
gcc/doc/cpp.texi
gcc/testsuite/ChangeLog
gcc/testsuite/objc/execute/selector-1.m

index 18c72b79f389f5e3f8f972d8b6549ef7c7b98769..dbb8057f6e7f8c880568173723f31a7eb8471660 100644 (file)
@@ -1,3 +1,9 @@
+2002-08-16  Stan Shebs  <shebs@apple.com>
+
+       * c-common.c (cb_register_builds): Define __NEXT_RUNTIME__
+       for ObjC with -fnext-runtime.
+       * doc/cpp.texi: Document it.
+
 2002-08-16  Janis Johnson  <janis187@us.ibm.com>
 
        * doc/install.texi (Final installation): Replace links to individual
index 2268d72c754d816fef94cc66a1677af587218d6a..74224afd55ca2c611a8290fd6047555cd6b45b90 100644 (file)
@@ -4745,6 +4745,10 @@ cb_register_builtins (pfile)
   if (!flag_signed_char)
     cpp_define (pfile, "__CHAR_UNSIGNED__");
 
+  /* Make the choice of ObjC runtime visible to source code.  */
+  if (flag_objc && flag_next_runtime)
+    cpp_define (pfile, "__NEXT_RUNTIME__");
+
   /* A straightforward target hook doesn't work, because of problems
      linking that hook's body when part of non-C front ends.  */
 # define preprocessing_asm_p() (cpp_get_options (pfile)->lang == CLK_ASM)
index e8107f2acc48ba4ee673de8e8693191c61ec1aa4..1284a39ad8aafede9fd1ae27c1c59eb83ae2b5c6 100644 (file)
@@ -2003,6 +2003,10 @@ the typedefs.
 This macro is defined, with value 1, if the compiler uses the old
 mechanism based on @code{setjmp} and @code{longjmp} for exception
 handling.
+
+@item __NEXT_RUNTIME__
+This macro is defined, with value 1, when the NeXT runtime
+(as in @option{-fnext-runtime}) is in use for Objective-C.
 @end table
 
 @node System-specific Predefined Macros
index e7fb9430275890096503cff06a9e7063b2cac1ba..bd0a52f690a99727d9369d800ea38badab057900 100644 (file)
@@ -1,3 +1,7 @@
+2002-08-16  Stan Shebs  <shebs@apple.com>
+
+       * objc/execute/selector-1.m: Add __NEXT_RUNTIME__ case.
+
 2002-08-15  Jakub Jelinek  <jakub@redhat.com>
 
        * gcc.dg/typeof-1.c: New test.
index 7e21da52a5edd3d5f200bf4d8b57a6b3e78689fe..531e02babcf8388eaa4fa7ea9e59a784902eba4f 100644 (file)
@@ -6,12 +6,16 @@
 int main (void)
 {
   SEL selector;
+  char *selname;
 
   selector = @selector (alloc);
-  if (strcmp (sel_get_name (selector), "alloc"))
-    {
-      abort ();
-    }
+#ifdef __NEXT_RUNTIME__
+  selname = sel_getName (selector);
+#else
+  selname = sel_get_name (selector);
+#endif
+  if (strcmp (selname, "alloc"))
+    abort ();
 
   return 0;
 }