shebs 02/08/27 15:54:43
Modified: gcc c-common.c cppinit.c gengtype.c
gcc/cp config-lang.in cp-lang.c decl.c
gcc/objc config-lang.in objc-act.c
gcc/objcp Make-lang.in config-lang.in objcp-decl.c
gcc/testsuite/g++.dg const-cfstring-1.C
gcc/testsuite/gcc.dg const-cfstring-1.c
gcc/testsuite/lib obj-c++.exp
gcc/testsuite/objc.dg const-cfstring-1.m
Added: gcc/cp cp-root.h
gcc/objc objc-root.h
gcc/objcp objcp-root.h
Log:
More import fixes; ObjC++ GC roots finally, C++ weak symbols,
testsuite tweaks for Linux.
Revision Changes Path
1.75 +2 -5 gcc3/gcc/c-common.c
Index: c-common.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/c-common.c,v
retrieving revision 1.74
retrieving revision 1.75
diff -u -r1.74 -r1.75
--- c-common.c 2002/08/26 20:07:57 1.74
+++ c-common.c 2002/08/27 22:54:36 1.75
@@ -1421,7 +1421,8 @@
int is_pascal_string = 0;
/* If first string is a Pascal string, that "wins". */
- if (TREE_TYPE (VARRAY_TREE (strings, 0)) == pascal_string_type_node)
+ if (nstrings > 0
+ && TREE_TYPE (VARRAY_TREE (strings, 0)) == pascal_string_type_node)
{
is_pascal_string = 1;
length = 2; /* account for the \p length byte, and the NUL. */
@@ -5001,10 +5002,6 @@
if (c_language == clk_cplusplus)
{
-/* APPLE LOCAL coalescing -- remove, as SUPPORTS is a -fcoalesce flag! */
-#undef SUPPORTS_ONE_ONLY
-#define SUPPORTS_ONE_ONLY 0
-/* APPLE LOCAL end coalescing */
if (SUPPORTS_ONE_ONLY)
cpp_define (pfile, "__GXX_WEAK__=1");
else
1.70 +1 -11 gcc3/gcc/cppinit.c
Index: cppinit.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cppinit.c,v
retrieving revision 1.69
retrieving revision 1.70
diff -u -r1.69 -r1.70
--- cppinit.c 2002/08/26 20:07:58 1.69
+++ cppinit.c 2002/08/27 22:54:36 1.70
@@ -841,17 +841,7 @@
}
if (CPP_OPTION (pfile, cplusplus))
- {
- _cpp_define_builtin (pfile, "__cplusplus 1");
-/* APPLE LOCAL coalescing -- remove, as SUPPORTS is a -fcoalesce flag! */
-#undef SUPPORTS_ONE_ONLY
-#define SUPPORTS_ONE_ONLY 0
-/* APPLE LOCAL end coalescing */
- if (SUPPORTS_ONE_ONLY)
- _cpp_define_builtin (pfile, "__GXX_WEAK__ 1");
- else
- _cpp_define_builtin (pfile, "__GXX_WEAK__ 0");
- }
+ _cpp_define_builtin (pfile, "__cplusplus 1");
else if (CPP_OPTION (pfile, lang) == CLK_ASM)
_cpp_define_builtin (pfile, "__ASSEMBLER__ 1");
else if (CPP_OPTION (pfile, lang) == CLK_STDC94)
1.2 +21 -15 gcc3/gcc/gengtype.c
Index: gengtype.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/gengtype.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- gengtype.c 2002/08/01 17:25:34 1.1
+++ gengtype.c 2002/08/27 22:54:37 1.2
@@ -667,6 +667,11 @@
int l1;
int l2;
s1 = basename - strlen (lang_dir_names [i]) - 1;
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Don't confuse "objcp/" with "cp/". */
+ if (s1[-1] != '/')
+ continue;
+ /* APPLE LOCAL end Objective-C++ */
s2 = lang_dir_names [i];
l1 = strlen (s1);
l2 = strlen (s2);
@@ -699,21 +704,11 @@
unsigned j;
unsigned k;
unsigned bitmap;
-
- if (slashpos)
- {
- size_t i;
- for (i = 1; i < NUM_BASE_FILES; i++)
- if ((size_t)(slashpos - basename) == strlen (lang_dir_names [i])
- && memcmp (basename, lang_dir_names[i], strlen (lang_dir_names[i])) == 0)
- {
- /* It's in a language directory, set that language. */
- bitmap = 1 << i;
- return bitmap;
- }
- abort (); /* Should have found the language. */
- }
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Lose the subdirectory-based scanning, it's redundant
+ if the config-lang.in lists are correct. */
+ /* APPLE LOCAL end Objective-C++ */
/* If it's in any config-lang.in, then set for the languages
specified. */
@@ -780,6 +775,17 @@
output_name = "gt-c-common.h", for_name = "c-common.c";
else if (strcmp (basename, "c-tree.h") == 0)
output_name = "gt-c-decl.h", for_name = "c-decl.c";
+ /* APPLE LOCAL begin Objective-C++ */
+ /* Put all lang-specific header roots in their own .h files. */
+ else if (strcmp (basename, "cp/cp-tree.h") == 0)
+ output_name = "gt-cp-cp-tree-h.h", for_name = "cp/cp-tree.h";
+ else if (strcmp (basename, "cp/decl.h") == 0)
+ output_name = "gt-cp-decl-h.h", for_name = "cp/decl.h";
+ else if (strcmp (basename, "cp/lex.h") == 0)
+ output_name = "gt-cp-lex-h.h", for_name = "cp/lex.h";
+ else if (strcmp (basename, "objc/objc-act.h") == 0)
+ output_name = "gt-objc-objc-act-h.h", for_name = "objc/objc-act.h";
+ /* APPLE LOCAL end Objective-C++ */
else
{
size_t i;
@@ -1129,7 +1135,7 @@
oprintf (of, "%*ssize_t i%d;\n", indent, "", loopcounter);
oprintf (of, "%*sggc_set_mark (%s.%s);\n", indent, "",
val, f->name);
- oprintf (of, "%*sfor (i%d = 0; i%d < (", indent, "",
+ oprintf (of, "%*sfor (i%d = 0; i%d < (size_t)(", indent, "",
loopcounter, loopcounter);
output_escaped_param (of, length, val, prev_val, "length", line);
oprintf (of, "); i%d++) {\n", loopcounter);
1.8 +2 -1 gcc3/gcc/cp/config-lang.in
Index: config-lang.in
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cp/config-lang.in,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- config-lang.in 2002/08/07 03:13:23 1.7
+++ config-lang.in 2002/08/27 22:54:38 1.8
@@ -37,4 +37,5 @@
target_libs="${libstdcxx_version} target-gperf"
-gtfiles="\$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h
\$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c
\$(srcdir)/cp/cp-parse.in \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/spew.c
\$(srcdir)/cp/tree.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c"
+# APPLE LOCAL Objective-C++
+gtfiles="\$(srcdir)/cp/cp-root.h \$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h
\$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c \$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c
\$(srcdir)/cp/cp-parse.in \$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/spew.c
\$(srcdir)/cp/tree.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c"
1.20 +18 -1 gcc3/gcc/cp/cp-lang.c
Index: cp-lang.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cp/cp-lang.c,v
retrieving revision 1.19
retrieving revision 1.20
diff -u -r1.19 -r1.20
--- cp-lang.c 2002/08/26 20:08:07 1.19
+++ cp-lang.c 2002/08/27 22:54:38 1.20
@@ -387,7 +387,6 @@
return -1;
}
#endif
-/* APPLE LOCAL end Objective-C++ */
/* Langhook for expr_size: Tell the backend that the value of an expression
of non-POD class type does not include any tail padding; a derived class
@@ -413,3 +412,21 @@
/* Use the default code. */
return lhd_expr_size (exp);
}
+
+/* APPLE LOCAL Objective-C++ */
+/* Include the GC roots here instead of in cp/decl.c, so we can
+ conditionalize on OBJCPLUS. */
+#include "decl.h"
+#include "ggc.h"
+#include "debug.h"
+#include "gt-cp-cp-tree-h.h"
+#include "gt-cp-decl-h.h"
+#include "gt-cp-lex-h.h"
+#ifdef OBJCPLUS
+tree objcp_dummy = 0;
+#include "gtype-objcp.h"
+#else
+tree cp_dummy = 0;
+#include "gtype-cp.h"
+#endif
+/* APPLE LOCAL end Objective-C++ */
1.113 +2 -1 gcc3/gcc/cp/decl.c
Index: decl.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/cp/decl.c,v
retrieving revision 1.112
retrieving revision 1.113
diff -u -r1.112 -r1.113
--- decl.c 2002/08/26 05:40:59 1.112
+++ decl.c 2002/08/27 22:54:38 1.113
@@ -15372,4 +15372,5 @@
/* APPLE LOCAL end PFE */
#include "gt-cp-decl.h"
-#include "gtype-cp.h"
+/* APPLE LOCAL Objective-C++ */
+/* Move gtype-cp.h to cp-lang.c. */
1.1 gcc3/gcc/cp/cp-root.h
Index: cp-root.h
===================================================================
/* APPLE LOCAL file Objective-C++ */
/* Empty file to be the base for gtype-cp.h. */
extern GTY(()) tree cp_dummy;
1.9 +2 -1 gcc3/gcc/objc/config-lang.in
Index: config-lang.in
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/objc/config-lang.in,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- config-lang.in 2002/08/02 10:08:58 1.8
+++ config-lang.in 2002/08/27 22:54:39 1.9
@@ -37,4 +37,5 @@
# target_libs=target-libobjc
# APPLE LOCAL end libobjc
-gtfiles="\$(srcdir)/objc/objc-act.h \$(srcdir)/c-parse.in \$(srcdir)/c-tree.h
\$(srcdir)/c-decl.c \$(srcdir)/c-objc-common.c \$(srcdir)/c-common.c
\$(srcdir)/c-common.h \$(srcdir)/c-pragma.c \$(srcdir)/c-parse.in"
+# APPLE LOCAL Objective-C++
+gtfiles="\$(srcdir)/objc/objc-root.h \$(srcdir)/objc/objc-act.h
\$(srcdir)/c-parse.in \$(srcdir)/c-tree.h \$(srcdir)/c-decl.c
\$(srcdir)/c-objc-common.c \$(srcdir)/c-common.c \$(srcdir)/c-common.h
\$(srcdir)/c-pragma.c \$(srcdir)/c-parse.in"
1.111 +20 -17 gcc3/gcc/objc/objc-act.c
Index: objc-act.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/objc/objc-act.c,v
retrieving revision 1.110
retrieving revision 1.111
diff -u -r1.110 -r1.111
--- objc-act.c 2002/08/26 20:08:10 1.110
+++ objc-act.c 2002/08/27 22:54:39 1.111
@@ -1338,8 +1338,24 @@
tree string, initlist, constructor, constant_string_class;
int length;
+ /* APPLE LOCAL constant cfstrings */
+ /* Move string combining up. */
+ if (TREE_CHAIN (strings))
+ {
+ varray_type vstrings;
+ VARRAY_TREE_INIT (vstrings, 32, "strings");
+
+ for (; strings ; strings = TREE_CHAIN (strings))
+ VARRAY_PUSH_TREE (vstrings, strings);
+
+ string = combine_strings (vstrings);
+ }
+ else
+ string = strings;
+
+ string = fix_string_type (string);
+
/* APPLE LOCAL begin constant cfstrings */
- string = combine_strings (strings);
/* The '-fconstant-cfstrings' switch trumps any '-fconstant-string-class'
setting. We must, however, cast the CFStringRef to id. */
if (flag_constant_cfstrings)
@@ -1358,21 +1374,6 @@
add_class_reference (constant_string_id);
- if (TREE_CHAIN (strings))
- {
- varray_type vstrings;
- VARRAY_TREE_INIT (vstrings, 32, "strings");
-
- for (; strings ; strings = TREE_CHAIN (strings))
- VARRAY_PUSH_TREE (vstrings, strings);
-
- string = combine_strings (vstrings);
- }
- else
- string = strings;
-
- string = fix_string_type (string);
-
/* APPLE LOCAL constant cfstrings */
/* Call to 'combine_strings' has been moved above. */
TREE_SET_CODE (string, STRING_CST);
@@ -9028,9 +9029,11 @@
}
/* APPLE LOCAL end PFE */
+
/* APPLE LOCAL begin Objective-C++ */
-/* Let the C++ gtype.h take precedence, since these define globals. */
+#include "gt-objc-objc-act-h.h"
#ifndef OBJCPLUS
+tree objc_dummy = 0;
#include "gtype-objc.h"
#endif
/* APPLE LOCAL end Objective-C++ */
1.1 gcc3/gcc/objc/objc-root.h
Index: objc-root.h
===================================================================
/* APPLE LOCAL file Objective-C++ */
/* Empty file to be the base for gtype-objc.h. */
extern GTY(()) tree objc_dummy;
1.12 +3 -1 gcc3/gcc/objcp/Make-lang.in
Index: Make-lang.in
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/objcp/Make-lang.in,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -r1.11 -r1.12
--- Make-lang.in 2002/08/21 15:43:46 1.11
+++ Make-lang.in 2002/08/27 22:54:41 1.12
@@ -164,6 +164,8 @@
-I$(srcdir)/objcp -DOBJCPLUS -c $(PFE_DIR)/objc-freeze-thaw.c \
$(OUTPUT_OPTION)
+gtype-objcp.h : s-gtype ; @true
+
#
# Build hooks:
@@ -222,7 +224,7 @@
-mv objcp/*$(objext) stage4/objcp
-mv cc1objplus$(exeext) stage4
- # These exist for maintenance purposes.
+# These exist for maintenance purposes.
# APPLE LOCAL Objective-C++
# Update the tags table.
1.7 +2 -0 gcc3/gcc/objcp/config-lang.in
Index: config-lang.in
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/objcp/config-lang.in,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- config-lang.in 2002/03/19 21:38:43 1.6
+++ config-lang.in 2002/08/27 22:54:41 1.7
@@ -39,3 +39,5 @@
# the object files we need, along with the libraries (libstdc++,
# libobjc).
lang_requires="objc c++"
+
+gtfiles="\$(srcdir)/objcp/objcp-root.h \$(srcdir)/objc/objc-act.h
\$(srcdir)/cp/cp-tree.h \$(srcdir)/cp/decl.h \$(srcdir)/cp/lex.h \$(srcdir)/cp/call.c
\$(srcdir)/cp/decl.c \$(srcdir)/cp/decl2.c \$(srcdir)/cp/cp-parse.in
\$(srcdir)/cp/pt.c \$(srcdir)/cp/repo.c \$(srcdir)/cp/spew.c \$(srcdir)/cp/tree.c
\$(srcdir)/c-common.c \$(srcdir)/c-common.h \$(srcdir)/c-pragma.c"
1.15 +1 -2 gcc3/gcc/objcp/objcp-decl.c
Index: objcp-decl.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/objcp/objcp-decl.c,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -r1.14 -r1.15
--- objcp-decl.c 2002/08/26 20:08:12 1.14
+++ objcp-decl.c 2002/08/27 22:54:41 1.15
@@ -135,7 +135,7 @@
tree attributes;
{
return start_decl (declarator, declspecs, initialized,
- attributes, NULL_TREE);
+ attributes, NULL_TREE);
}
void
@@ -316,4 +316,3 @@
return (objc_id != NULL_TREE);
}
-
1.1 gcc3/gcc/objcp/objcp-root.h
Index: objcp-root.h
===================================================================
/* APPLE LOCAL file Objective-C++ */
/* Empty file to be the base for gtype-objcp.h. */
extern GTY(()) tree objcp_dummy;
1.2 +1 -1 gcc3/gcc/testsuite/g++.dg/const-cfstring-1.C
Index: const-cfstring-1.C
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/testsuite/g++.dg/const-cfstring-1.C,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- const-cfstring-1.C 2002/06/08 01:05:02 1.1
+++ const-cfstring-1.C 2002/08/27 22:54:42 1.2
@@ -4,8 +4,8 @@
argument. This will only work on MacOS X 10.1.2 and later. */
/* Developed by Ziemowit Laski <[EMAIL PROTECTED]>. */
+/* { dg-do compile { target powerpc-apple-darwin* } */
/* { dg-options "-fconstant-cfstrings" } */
-/* { dg-do compile } */
#import <CoreFoundation/CFString.h>
1.2 +1 -1 gcc3/gcc/testsuite/gcc.dg/const-cfstring-1.c
Index: const-cfstring-1.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/testsuite/gcc.dg/const-cfstring-1.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- const-cfstring-1.c 2002/06/08 01:05:02 1.1
+++ const-cfstring-1.c 2002/08/27 22:54:42 1.2
@@ -4,8 +4,8 @@
argument. This will only work on MacOS X 10.1.2 and later. */
/* Developed by Ziemowit Laski <[EMAIL PROTECTED]>. */
+/* { dg-do compile { target powerpc-apple-darwin* } */
/* { dg-options "-fconstant-cfstrings" } */
-/* { dg-do compile } */
#import <CoreFoundation/CFString.h>
1.2 +1 -1 gcc3/gcc/testsuite/lib/obj-c++.exp
Index: obj-c++.exp
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/testsuite/lib/obj-c++.exp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- obj-c++.exp 2002/08/22 23:09:22 1.1
+++ obj-c++.exp 2002/08/27 22:54:43 1.2
@@ -166,7 +166,7 @@
lappend options "compiler=$OBJCXX_UNDER_TEST"
- set ld_library_path ".:${rootme}"
+ #set ld_library_path ".:${rootme}"
lappend options "libs=-lstdc++"
if { [target_info needs_status_wrapper]!="" && [info exists gluefile] } {
1.2 +1 -1 gcc3/gcc/testsuite/objc.dg/const-cfstring-1.m
Index: const-cfstring-1.m
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/testsuite/objc.dg/const-cfstring-1.m,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- const-cfstring-1.m 2002/04/24 23:45:23 1.1
+++ const-cfstring-1.m 2002/08/27 22:54:43 1.2
@@ -5,8 +5,8 @@
on MacOS X 10.1.2 and later. */
/* Developed by Ziemowit Laski <[EMAIL PROTECTED]>. */
+/* { dg-do run { target powerpc-apple-darwin* } */
/* { dg-options "-fconstant-cfstrings -framework Cocoa" } */
-/* { dg-do run } */
#import <Foundation/NSString.h>
#import <CoreFoundation/CFString.h>