From 8aa5074e79a708a7ef26c5931a1f6485a0726042 Mon Sep 17 00:00:00 2001 From: Stan Shebs Date: Fri, 16 Aug 2002 23:31:06 +0000 Subject: [PATCH] c-common.c (cb_register_builds): Define __NEXT_RUNTIME__ for ObjC with -fnext-runtime. * 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 | 6 ++++++ gcc/c-common.c | 4 ++++ gcc/doc/cpp.texi | 4 ++++ gcc/testsuite/ChangeLog | 4 ++++ gcc/testsuite/objc/execute/selector-1.m | 12 ++++++++---- 5 files changed, 26 insertions(+), 4 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 18c72b79f38..dbb8057f6e7 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2002-08-16 Stan Shebs + + * c-common.c (cb_register_builds): Define __NEXT_RUNTIME__ + for ObjC with -fnext-runtime. + * doc/cpp.texi: Document it. + 2002-08-16 Janis Johnson * doc/install.texi (Final installation): Replace links to individual diff --git a/gcc/c-common.c b/gcc/c-common.c index 2268d72c754..74224afd55c 100644 --- a/gcc/c-common.c +++ b/gcc/c-common.c @@ -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) diff --git a/gcc/doc/cpp.texi b/gcc/doc/cpp.texi index e8107f2acc4..1284a39ad8a 100644 --- a/gcc/doc/cpp.texi +++ b/gcc/doc/cpp.texi @@ -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 diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog index e7fb9430275..bd0a52f690a 100644 --- a/gcc/testsuite/ChangeLog +++ b/gcc/testsuite/ChangeLog @@ -1,3 +1,7 @@ +2002-08-16 Stan Shebs + + * objc/execute/selector-1.m: Add __NEXT_RUNTIME__ case. + 2002-08-15 Jakub Jelinek * gcc.dg/typeof-1.c: New test. diff --git a/gcc/testsuite/objc/execute/selector-1.m b/gcc/testsuite/objc/execute/selector-1.m index 7e21da52a5e..531e02babcf 100644 --- a/gcc/testsuite/objc/execute/selector-1.m +++ b/gcc/testsuite/objc/execute/selector-1.m @@ -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; } -- 2.30.2