shebs 02/08/13 22:33:19
Modified: gcc c-lang.c c-pragma.c diagnostic.c
gcc/config darwin.c darwin.h
gcc/config/rs6000 darwin.h
Log:
More merge fixes; pragmas, select_section, error-colon in diagnostics.
Revision Changes Path
1.27 +2 -7 gcc3/gcc/c-lang.c
Index: c-lang.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/c-lang.c,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- c-lang.c 2002/08/08 03:19:50 1.26
+++ c-lang.c 2002/08/14 05:33:17 1.27
@@ -49,8 +49,7 @@
#define LANG_HOOKS_FINISH_FILE c_objc_common_finish_file
/* APPLE LOCAL Objective-C++ end */
#undef LANG_HOOKS_INIT_OPTIONS
-/* APPLE LOCAL */
-#define LANG_HOOKS_INIT_OPTIONS lang_init_options
+#define LANG_HOOKS_INIT_OPTIONS c_init_options
#undef LANG_HOOKS_DECODE_OPTION
#define LANG_HOOKS_DECODE_OPTION c_decode_option
#undef LANG_HOOKS_POST_OPTIONS
@@ -154,9 +153,6 @@
#define LANG_HOOKS_PFE_CHECK_SETTINGS c_pfe_check_settings
/* APPLE LOCAL end PFE */
-/* APPLE LOCAL Objective-C++ */
-static void lang_init_options PARAMS ((void));
-
/* ### When changing hooks, consider if ObjC needs changing too!! ### */
/* Each front end provides its own. */
@@ -198,12 +194,11 @@
#undef DEFTREECODE
static void
-lang_init_options ()
+c_init_options ()
{
c_common_init_options (clk_c);
}
-/* APPLE MERGE lose the following? */
static const char *
c_init (filename)
const char *filename;
1.8 +5 -0 gcc3/gcc/c-pragma.c
Index: c-pragma.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/c-pragma.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -r1.7 -r1.8
--- c-pragma.c 2002/08/02 10:05:05 1.7
+++ c-pragma.c 2002/08/14 05:33:17 1.8
@@ -505,6 +505,11 @@
handle_pragma_extern_prefix);
#endif
+ /* APPLE LOCAL begin OS pragma hook */
+#ifdef REGISTER_OS_PRAGMAS
+ REGISTER_OS_PRAGMAS (parse_in);
+#endif
+ /* APPLE LOCAL end OS pragma hook */
#ifdef REGISTER_TARGET_PRAGMAS
REGISTER_TARGET_PRAGMAS (parse_in);
#endif
1.30 +13 -49 gcc3/gcc/diagnostic.c
Index: diagnostic.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/diagnostic.c,v
retrieving revision 1.29
retrieving revision 1.30
diff -u -r1.29 -r1.30
--- diagnostic.c 2002/08/08 03:19:50 1.29
+++ diagnostic.c 2002/08/14 05:33:17 1.30
@@ -642,41 +642,6 @@
return str;
}
-#if 0 /* APPLE LOCAL orphan */
-/* Return a malloc'd string describing a location. The caller is
- responsible for freeing the memory. */
-
-char *
-context_as_prefix (file, line, warn)
- const char *file;
- int line;
- int warn;
-{
- if (file)
- {
- if (warn)
- return build_message_string (_("%s:%d: warning: "), file, line);
- /* APPLE LOCAL begin error-colon */
- else if (gcc_error_colon)
- return build_message_string ("%s:%d: error: ", file, line);
- /* APPLE LOCAL end error-colon */
- else
- return build_message_string ("%s:%d: ", file, line);
- }
- else
- {
- if (warn)
- return build_message_string (_("%s: warning: "), progname);
- /* APPLE LOCAL begin error-colon */
- else if (gcc_error_colon)
- return build_message_string ("%s: error: ", progname);
- /* APPLE LOCAL end error-colon */
- else
- return build_message_string ("%s: ", progname);
- }
-}
-#endif
-
/* Same as diagnsotic_build_prefix, but only the source FILE is given. */
char *
file_name_as_prefix (f)
@@ -684,7 +649,7 @@
{
/* APPLE LOCAL begin error-colon */
if (gcc_error_colon)
- return build_message_string ("%s:error: ", f);
+ return build_message_string ("%s: error: ", f);
else
/* APPLE LOCAL end error-colon */
return build_message_string ("%s: ", f);
@@ -927,12 +892,22 @@
void
diagnostic_flush_buffer (context)
diagnostic_context *context;
+{
+ output_buffer_to_stream (&context->buffer);
+ fflush (output_buffer_attached_stream (&context->buffer));
+}
+
+/* Count a diagnostic. Return true if the message should be printed. */
+bool
+diagnostic_count_diagnostic (context, kind)
+ diagnostic_context *context;
+ diagnostic_t kind;
{
-#if 0 /* APPLE MERGE where should this go? */
/* APPLE LOCAL begin error-colon */
+ /* Here so it gets executed early on. */
{
static int done = 0;
- if ( ! done)
+ if (!done)
{
done = 1; /* Do this only once. */
/* Pretend we saw "-w" on commandline. */
@@ -943,17 +918,6 @@
}
}
/* APPLE LOCAL end error-colon */
-#endif
- output_buffer_to_stream (&context->buffer);
- fflush (output_buffer_attached_stream (&context->buffer));
-}
-
-/* Count a diagnostic. Return true if the message should be printed. */
-bool
-diagnostic_count_diagnostic (context, kind)
- diagnostic_context *context;
- diagnostic_t kind;
-{
switch (kind)
{
default:
1.74 +53 -3 gcc3/gcc/config/darwin.c
Index: darwin.c
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/config/darwin.c,v
retrieving revision 1.73
retrieving revision 1.74
diff -u -r1.73 -r1.74
--- darwin.c 2002/08/07 03:13:20 1.73
+++ darwin.c 2002/08/14 05:33:18 1.74
@@ -1344,16 +1344,59 @@
&& TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE
&& TYPE_NAME (TREE_TYPE (exp)))
{
+ /* APPLE LOCAL begin constant strings */
+ extern int flag_next_runtime;
+ extern const char *constant_string_class_name;
+ /* APPLE LOCAL end constant strings */
tree name = TYPE_NAME (TREE_TYPE (exp));
if (TREE_CODE (name) == TYPE_DECL)
name = DECL_NAME (name);
+ /* APPLE LOCAL begin constant strings */
+ if (constant_string_class_name
+ && !strcmp (IDENTIFIER_POINTER (name),
+ constant_string_class_name))
+ {
+ if (flag_next_runtime)
+ objc_constant_string_object_section ();
+ else
+ objc_string_object_section ();
+ }
+ /* APPLE LOCAL end constant strings */
if (!strcmp (IDENTIFIER_POINTER (name), "NSConstantString"))
objc_constant_string_object_section ();
else if (!strcmp (IDENTIFIER_POINTER (name), "NXConstantString"))
objc_string_object_section ();
else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
+ {
+ /* APPLE LOCAL dynamic-no-pic */
+ if (TREE_SIDE_EFFECTS (exp) || (MACHOPIC_INDIRECT && reloc))
+ const_data_section ();
+ else
+ readonly_data_section ();
+ }
+ else
+ data_section ();
+ }
+ /* APPLE LOCAL begin constant cfstrings */
+ else if (TREE_CODE (exp) == CONSTRUCTOR
+ && TREE_TYPE (exp)
+ && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE
+ && TREE_OPERAND (exp, 1))
+ {
+ tree name = TREE_OPERAND (exp, 1);
+ if (TREE_CODE (name) == TREE_LIST && TREE_VALUE (name)
+ && TREE_CODE (TREE_VALUE (name)) == NOP_EXPR
+ && TREE_OPERAND (TREE_VALUE (name), 0)
+ && TREE_OPERAND (TREE_OPERAND (TREE_VALUE (name), 0), 0))
+ name = TREE_OPERAND (TREE_OPERAND (TREE_VALUE (name), 0), 0);
+ if (TREE_CODE (name) == VAR_DECL
+ && !strcmp (IDENTIFIER_POINTER (DECL_NAME (name)),
+ "__CFConstantStringClassReference"))
+ cfstring_constant_object_section ();
+ else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
{
- if (TREE_SIDE_EFFECTS (exp) || flag_pic && reloc)
+ /* APPLE LOCAL dynamic-no-pic */
+ if (TREE_SIDE_EFFECTS (exp) || (MACHOPIC_INDIRECT && reloc))
const_data_section ();
else
readonly_data_section ();
@@ -1361,6 +1404,7 @@
else
data_section ();
}
+ /* APPLE LOCAL end constant cfstrings */
else if (TREE_CODE (exp) == VAR_DECL &&
DECL_NAME (exp) &&
TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE &&
@@ -1416,7 +1460,8 @@
else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp))
&& !TREE_SIDE_EFFECTS (exp))
{
- if (flag_pic && reloc)
+ /* APPLE LOCAL dynamic-no-pic */
+ if (MACHOPIC_INDIRECT && reloc)
const_data_section ();
else
readonly_data_section ();
@@ -1424,9 +1469,14 @@
else
data_section ();
}
+ /* APPLE LOCAL begin darwin_set_section_for_var_p */
+ else if (darwin_set_section_for_var_p (exp, reloc, align))
+ ;
+ /* APPLE LOCAL end darwin_set_section_for_var_p */
else if (TREE_READONLY (exp) || TREE_CONSTANT (exp))
{
- if (TREE_SIDE_EFFECTS (exp) || flag_pic && reloc)
+ /* APPLE LOCAL dynamic-no-pic */
+ if (TREE_SIDE_EFFECTS (exp) || (MACHOPIC_INDIRECT && reloc))
const_data_section ();
else
readonly_data_section ();
1.175 +3 -175 gcc3/gcc/config/darwin.h
Index: darwin.h
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/config/darwin.h,v
retrieving revision 1.174
retrieving revision 1.175
diff -u -r1.174 -r1.175
--- darwin.h 2002/08/08 03:19:58 1.174
+++ darwin.h 2002/08/14 05:33:18 1.175
@@ -741,179 +741,6 @@
#define READONLY_DATA_SECTION const_section
-#if 0 /* APPLE MERGE move local bits into functions? */
-#undef SELECT_SECTION
-#define SELECT_SECTION(exp,reloc,align) \
- do \
- { \
- if (TREE_CODE (exp) == STRING_CST) \
- { \
- if (flag_writable_strings) \
- data_section (); \
- else if (TREE_STRING_LENGTH (exp) != \
- strlen (TREE_STRING_POINTER (exp)) + 1) \
- readonly_data_section (); \
- else \
- cstring_section (); \
- } \
- else if (TREE_CODE (exp) == INTEGER_CST \
- || TREE_CODE (exp) == REAL_CST) \
- { \
- tree size = TYPE_SIZE (TREE_TYPE (exp)); \
- \
- if (TREE_CODE (size) == INTEGER_CST && \
- TREE_INT_CST_LOW (size) == 4 && \
- TREE_INT_CST_HIGH (size) == 0) \
- literal4_section (); \
- else if (TREE_CODE (size) == INTEGER_CST && \
- TREE_INT_CST_LOW (size) == 8 && \
- TREE_INT_CST_HIGH (size) == 0) \
- literal8_section (); \
- else \
- readonly_data_section (); \
- } \
- else if (TREE_CODE (exp) == CONSTRUCTOR \
- && TREE_TYPE (exp) \
- && TREE_CODE (TREE_TYPE (exp)) == RECORD_TYPE \
- && TYPE_NAME (TREE_TYPE (exp))) \
- { \
- /* APPLE LOCAL begin constant strings */ \
- extern int flag_next_runtime; \
- extern char *constant_string_class_name; \
- /* APPLE LOCAL end constant strings */ \
- tree name = TYPE_NAME (TREE_TYPE (exp)); \
- if (TREE_CODE (name) == TYPE_DECL) \
- name = DECL_NAME (name); \
- /* APPLE LOCAL begin constant strings */ \
- if (constant_string_class_name \
- && !strcmp (IDENTIFIER_POINTER (name), \
- constant_string_class_name)) { \
- if (flag_next_runtime) \
- objc_constant_string_object_section (); \
- else \
- objc_string_object_section (); \
- } \
- /* APPLE LOCAL end constant strings */ \
- else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) \
- { \
- /* APPLE LOCAL dynamic-no-pic */ \
- if (TREE_SIDE_EFFECTS (exp) || MACHOPIC_INDIRECT && reloc)\
- const_data_section (); \
- else \
- readonly_data_section (); \
- } \
- else \
- data_section (); \
- } \
- /* APPLE LOCAL begin constant cfstrings */ \
- else if (TREE_CODE (exp) == CONSTRUCTOR \
- && TREE_TYPE (exp) \
- && TREE_CODE (TREE_TYPE (exp)) == ARRAY_TYPE \
- && TREE_OPERAND (exp, 1)) \
- { \
- tree name = TREE_OPERAND (exp, 1); \
- if (TREE_CODE (name) == TREE_LIST && TREE_VALUE (name) \
- && TREE_CODE (TREE_VALUE (name)) == NOP_EXPR \
- && TREE_OPERAND (TREE_VALUE (name), 0) \
- && TREE_OPERAND (TREE_OPERAND (TREE_VALUE (name), 0), 0)) \
- { \
- name = TREE_OPERAND \
- (TREE_OPERAND (TREE_VALUE (name), 0), 0); \
- } \
- if (TREE_CODE (name) == VAR_DECL \
- && !strcmp (IDENTIFIER_POINTER (DECL_NAME (name)), \
- "__CFConstantStringClassReference")) \
- cfstring_constant_object_section (); \
- else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) \
- { \
- /* APPLE LOCAL dynamic-no-pic */ \
- if (TREE_SIDE_EFFECTS (exp) || MACHOPIC_INDIRECT && reloc)\
- const_data_section (); \
- else \
- readonly_data_section (); \
- } \
- else \
- data_section (); \
- } \
- /* APPLE LOCAL end constant cfstrings */ \
- else if (TREE_CODE (exp) == VAR_DECL && \
- DECL_NAME (exp) && \
- TREE_CODE (DECL_NAME (exp)) == IDENTIFIER_NODE && \
- IDENTIFIER_POINTER (DECL_NAME (exp)) && \
- !strncmp (IDENTIFIER_POINTER (DECL_NAME (exp)), "_OBJC_", 6)) \
- { \
- const char *name = IDENTIFIER_POINTER (DECL_NAME (exp)); \
- \
- if (!strncmp (name, "_OBJC_CLASS_METHODS_", 20)) \
- objc_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_INSTANCE_METHODS_", 23)) \
- objc_inst_meth_section (); \
- else if (!strncmp (name, "_OBJC_CATEGORY_CLASS_METHODS_", 20)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_CATEGORY_INSTANCE_METHODS_", 23)) \
- objc_cat_inst_meth_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_VARIABLES_", 22)) \
- objc_class_vars_section (); \
- else if (!strncmp (name, "_OBJC_INSTANCE_VARIABLES_", 25)) \
- objc_instance_vars_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_PROTOCOLS_", 22)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_NAME_", 17)) \
- objc_class_names_section (); \
- else if (!strncmp (name, "_OBJC_METH_VAR_NAME_", 20)) \
- objc_meth_var_names_section (); \
- else if (!strncmp (name, "_OBJC_METH_VAR_TYPE_", 20)) \
- objc_meth_var_types_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_REFERENCES", 22)) \
- objc_cls_refs_section (); \
- else if (!strncmp (name, "_OBJC_CLASS_", 12)) \
- objc_class_section (); \
- else if (!strncmp (name, "_OBJC_METACLASS_", 16)) \
- objc_meta_class_section (); \
- else if (!strncmp (name, "_OBJC_CATEGORY_", 15)) \
- objc_category_section (); \
- else if (!strncmp (name, "_OBJC_SELECTOR_REFERENCES", 25)) \
- objc_selector_refs_section (); \
- else if (!strncmp (name, "_OBJC_SELECTOR_FIXUP", 20)) \
- objc_selector_fixup_section (); \
- else if (!strncmp (name, "_OBJC_SYMBOLS", 13)) \
- objc_symbols_section (); \
- else if (!strncmp (name, "_OBJC_MODULES", 13)) \
- objc_module_info_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_INSTANCE_METHODS_", 32)) \
- objc_cat_inst_meth_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_CLASS_METHODS_", 29)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_REFS_", 20)) \
- objc_cat_cls_meth_section (); \
- else if (!strncmp (name, "_OBJC_PROTOCOL_", 15)) \
- objc_protocol_section (); \
- else if ((TREE_READONLY (exp) || TREE_CONSTANT (exp)) \
- && !TREE_SIDE_EFFECTS (exp)) \
- /* APPLE LOCAL dynamic-no-pic */ \
- { if (MACHOPIC_INDIRECT && reloc ) const_data_section (); \
- else readonly_data_section (); } \
- else \
- data_section (); \
- } \
- else \
- /* APPLE LOCAL darwin_set_section_for_var_p */ \
- if (darwin_set_section_for_var_p (exp, reloc, align)) \
- ; \
- else if (TREE_READONLY (exp) || TREE_CONSTANT (exp)) \
- { \
- /* APPLE LOCAL dynamic-no-pic */ \
- if (TREE_SIDE_EFFECTS (exp) || MACHOPIC_INDIRECT && reloc) \
- const_data_section (); \
- else \
- readonly_data_section (); \
- } \
- else \
- data_section (); \
- try_section_alias (); \
- } \
- while (0)
-#endif
#undef TARGET_ASM_SELECT_SECTION
#define TARGET_ASM_SELECT_SECTION machopic_select_section
#undef TARGET_ASM_SELECT_RTX_SECTION
@@ -1210,8 +1037,9 @@
/* APPLE LOCAL end C++ EH turly 20020208 */
/* APPLE FIXME set up to add rs6000 pragmas... */
-#undef REGISTER_TARGET_PRAGMAS
-#define REGISTER_TARGET_PRAGMAS(PFILE) \
+/* APPLE LOCAL OS pragma hook */
+#undef REGISTER_OS_PRAGMAS
+#define REGISTER_OS_PRAGMAS(PFILE) \
do { \
cpp_register_pragma (PFILE, 0, "mark", darwin_pragma_ignore); \
cpp_register_pragma (PFILE, 0, "options", darwin_pragma_options); \
1.72 +2 -4 gcc3/gcc/config/rs6000/darwin.h
Index: darwin.h
===================================================================
RCS file: /cvs/Darwin/gcc3/gcc/config/rs6000/darwin.h,v
retrieving revision 1.71
retrieving revision 1.72
diff -u -r1.71 -r1.72
--- darwin.h 2002/08/07 03:13:21 1.71
+++ darwin.h 2002/08/14 05:33:19 1.72
@@ -333,7 +333,5 @@
#define BOOL_TYPE_SIZE INT_TYPE_SIZE
#endif
-#if 0 /* APPLE MERGE figure this out */
-#undef REGISTER_TARGET_PRAGMAS
-#define REGISTER_TARGET_PRAGMAS DARWIN_REGISTER_TARGET_PRAGMAS
-#endif
+/* APPLE LOCAL OS pragma hook */
+/* Register generic Darwin pragmas as "OS" pragmas. */