This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Patch to use target structure for more attribute-related macros
- To: <gcc-patches at gcc dot gnu dot org>
- Subject: Patch to use target structure for more attribute-related macros
- From: "Joseph S. Myers" <jsm28 at cam dot ac dot uk>
- Date: Fri, 29 Jun 2001 15:35:20 +0100 (BST)
This patch moves COMP_TYPE_ATTRIBUTES and SET_DEFAULT_TYPE_ATTRIBUTES
into the target structure. A lot of it is simply removing default
definitions from various targets that did what the compiler did by
default anyway and so weren't necessary.
Bootstrapped with no regressions on i686-pc-linux-gnu. It passes
"make info" and "make dvi", and building as far as failing to build
libgcc for lack of a target assembler when targetted to arc-elf,
m32r-elf, m68hc11-elf, ns32k-netbsd, powerpc-eabi, d30v-elf, and
arm-elf (to check there weren't typos in the target changes that would
cause them to fail). OK to commit?
2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
* target.h (struct gcc_target): Add comp_type_attributse and
set_default_type_attributes.
* target-def.h (TARGET_COMP_TYPE_ATTRIBUTES,
TARGET_SET_DEFAULT_TYPE_ATTRIBUTES): Define.
(TARGET_INITIALIZER): Update.
* doc/tm.texi (COMP_TYPE_ATTRIBUTES, TARGET_COMP_TYPE_ATTRIBUTES,
SET_DEFAULT_TYPE_ATTRIBUTES, TARGET_SET_DEFAULT_TYPE_ATTRIBUTES):
Update documentation of old target macros to describe new target
hooks.
* tree.c (make_node): Use target.set_default_type_attributes.
(default_comp_type_attributes,
default_set_default_type_attributes): New functions.
* tree.h (default_comp_type_attributes,
default_set_default_type_attributes): Declare.
* c-typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
(comptypes): Use target.comp_type_attributes.
* config/arc/arc-protos.h, config/arc/arc.c, config/arc/arc.h
(arc_comp_type_attributes, arc_set_default_type_attributes,
COMP_TYPE_ATTRIBUTES, SET_DEFAULT_TYPE_ATTRIBUTES): Remove
functions and macros with default behaviour.
* config/m32r/m32r-protos.h, config/m32r/m32r.c,
config/m32r/m32r.h (m32r_comp_type_attributes,
m32r_set_default_type_attributes, COMP_TYPE_ATTRIBUTES,
SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
* config/m68hc11/m68hc11-protos.h, config/m68hc11/m68hc11.c,
config/m68hc11/m68hc11.h (m68hc11_comp_type_attributes,
m68hc11_set_default_type_attributes, COMP_TYPE_ATTRIBUTES,
SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
* config/ns32k/ns32k-protos.h, config/ns32k/ns32k.c,
config/ns32k/ns32k.h (ns32k_comp_type_attributes,
COMP_TYPE_ATTRIBUTES): Likewise.
* config/rs6000/rs6000-protos.h, config/rs6000/rs6000.c,
config/rs6000/rs6000.h (rs6000_comp_type_attributes,
rs6000_set_default_type_attributes, COMP_TYPE_ATTRIBUTES,
SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
* config/d30v/d30v.h (COMP_TYPE_ATTRIBUTES,
SET_DEFAULT_TYPE_ATTRIBUTES): Remove commented out macro
definitions.
* config/i386/i386.h (SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
* config/ns32k/ns32k.h (SET_DEFAULT_TYPE_ATTRIBUTES): Likewise.
* config/arm/arm.c (arm_comp_type_attributes,
arm_set_default_type_attributes): Make static.
(TARGET_COMP_TYPE_ATTRIBUTES, TARGET_SET_DEFAULT_TYPE_ATTRIBUTES):
Define.
* config/arm/arm.h (COMP_TYPE_ATTRIBUTES,
SET_DEFAULT_TYPE_ATTRIBUTES): Don't define.
* config/arm/arm-protos.h (arm_comp_type_attributes,
arm_set_default_type_attributes): Don't declare.
* config/i386/i386.c (ix86_comp_type_attributes): Make static.
(TARGET_COMP_TYPE_ATTRIBUTES): Define.
* config/i386/i386.h (COMP_TYPE_ATTRIBUTES): Don't define.
* config/i386/i386-protos.h (ix86_comp_type_attributes): Don't
declare.
cp:
2001-06-29 Joseph S. Myers <jsm28@cam.ac.uk>
* typeck.c (COMP_TYPE_ATTRIBUTES): Don't define.
(comptypes): Use target.comp_type_attributes.
diff -rupN gcc.orig/c-typeck.c gcc/c-typeck.c
--- gcc.orig/c-typeck.c Tue Jun 26 19:14:53 2001
+++ gcc/c-typeck.c Fri Jun 29 11:13:54 2001
@@ -483,12 +483,8 @@ comptypes (type1, type2)
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
+ if (! (attrval = (*target.comp_type_attributes) (t1, t2)))
return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
diff -rupN gcc.orig/config/arc/arc-protos.h gcc/config/arc/arc-protos.h
--- gcc.orig/config/arc/arc-protos.h Tue Jun 26 19:14:58 2001
+++ gcc/config/arc/arc-protos.h Fri Jun 29 11:44:03 2001
@@ -60,8 +60,6 @@ extern int shift_operator PARAMS ((rtx,
#ifdef TREE_CODE
extern enum arc_function_type arc_compute_function_type PARAMS ((tree));
-extern int arc_comp_type_attributes PARAMS ((tree, tree));
-extern void arc_set_default_type_attributes PARAMS ((tree));
extern void arc_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree,
int *, int));
diff -rupN gcc.orig/config/arc/arc.c gcc/config/arc/arc.c
--- gcc.orig/config/arc/arc.c Tue Jun 26 19:14:58 2001
+++ gcc/config/arc/arc.c Fri Jun 29 11:44:21 2001
@@ -342,24 +342,6 @@ arc_valid_decl_attribute (type, attribut
return 0;
}
-/* Return zero if TYPE1 and TYPE are incompatible, one if they are compatible,
- and two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-arc_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED, type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* Set the default attributes for TYPE. */
-
-void
-arc_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
-}
/* Acceptable arguments to the call insn. */
diff -rupN gcc.orig/config/arc/arc.h gcc/config/arc/arc.h
--- gcc.orig/config/arc/arc.h Tue Jun 26 19:14:58 2001
+++ gcc/config/arc/arc.h Fri Jun 29 11:43:57 2001
@@ -1575,16 +1575,6 @@ do { if ((LOG) != 0) fprintf (FILE, "\t.
/* A function address in a call instruction. */
#define FUNCTION_MODE SImode
-/* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
- incompatible, one if they are compatible, and two if they are
- nearly compatible (which causes a warning to be generated). */
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
-arc_comp_type_attributes (TYPE1, TYPE2)
-
-/* Give newly defined TYPE some default attributes. */
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
-arc_set_default_type_attributes (TYPE)
-
/* alloca should avoid clobbering the old register save area. */
/* ??? Not defined in tm.texi. */
#define SETJMP_VIA_SAVE_AREA
diff -rupN gcc.orig/config/arm/arm-protos.h gcc/config/arm/arm-protos.h
--- gcc.orig/config/arm/arm-protos.h Tue Jun 26 19:14:58 2001
+++ gcc/config/arm/arm-protos.h Fri Jun 29 11:45:45 2001
@@ -38,8 +38,6 @@ extern unsigned long arm_current_func_ty
#ifdef TREE_CODE
extern int arm_return_in_memory PARAMS ((tree));
-extern int arm_comp_type_attributes PARAMS ((tree, tree));
-extern void arm_set_default_type_attributes PARAMS ((tree));
extern void arm_encode_call_attribute PARAMS ((tree, int));
extern int arm_function_ok_for_sibcall PARAMS ((tree));
#endif
diff -rupN gcc.orig/config/arm/arm.c gcc/config/arm/arm.c
--- gcc.orig/config/arm/arm.c Tue Jun 26 19:14:58 2001
+++ gcc/config/arm/arm.c Fri Jun 29 11:46:48 2001
@@ -106,6 +106,8 @@ static int arm_valid_type_attribute_p P
tree, tree));
static int arm_valid_decl_attribute_p PARAMS ((tree, tree,
tree, tree));
+static int arm_comp_type_attributes PARAMS ((tree, tree));
+static void arm_set_default_type_attributes PARAMS ((tree));
#undef Hint
#undef Mmode
#undef Ulong
@@ -128,6 +130,12 @@ static int arm_valid_decl_attribute_p P
# define TARGET_VALID_DECL_ATTRIBUTE arm_valid_decl_attribute_p
#endif
+#undef TARGET_COMP_TYPE_ATTRIBUTES
+#define TARGET_COMP_TYPE_ATTRIBUTES arm_comp_type_attributes
+
+#undef TARGET_SET_DEFAULT_TYPE_ATTRIBUTES
+#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES arm_set_default_type_attributes
+
struct gcc_target target = TARGET_INITIALIZER;
/* Obstack for minipool constant handling. */
@@ -1913,7 +1921,7 @@ arm_valid_type_attribute_p (type, attrib
/* Return 0 if the attributes for two types are incompatible, 1 if they
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated). */
-int
+static int
arm_comp_type_attributes (type1, type2)
tree type1;
tree type2;
@@ -1984,7 +1992,7 @@ arm_encode_call_attribute (decl, flag)
/* Assigns default attributes to newly defined type. This is used to
set short_call/long_call attributes for function types of
functions defined inside corresponding #pragma scopes. */
-void
+static void
arm_set_default_type_attributes (type)
tree type;
{
diff -rupN gcc.orig/config/arm/arm.h gcc/config/arm/arm.h
--- gcc.orig/config/arm/arm.h Tue Jun 26 19:14:58 2001
+++ gcc/config/arm/arm.h Fri Jun 29 11:47:58 2001
@@ -2542,18 +2542,6 @@ extern const char * arm_pic_register_str
offset. */
extern int making_const_table;
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (arm_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- arm_set_default_type_attributes (TYPE)
-
/* Handle pragmas for compatibility with Intel's compilers. */
#define REGISTER_TARGET_PRAGMAS(PFILE) do { \
cpp_register_pragma (PFILE, 0, "long_calls", arm_pr_long_calls); \
diff -rupN gcc.orig/config/d30v/d30v.h gcc/config/d30v/d30v.h
--- gcc.orig/config/d30v/d30v.h Tue Jun 26 19:14:58 2001
+++ gcc/config/d30v/d30v.h Fri Jun 29 11:39:39 2001
@@ -5889,15 +5889,6 @@ fprintf (STREAM, "\t.word .L%d\n", VALUE
must also be defined). */
/* #define HANDLE_WEAK_PRAGMA */
-/* If defined, a C expression whose value is zero if the attributes on TYPE1
- and TYPE2 are incompatible, one if they are compatible, and two if they are
- nearly compatible (which causes a warning to be generated). */
-/* #define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) */
-
-/* If defined, a C statement that assigns default attributes to newly defined
- TYPE. */
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) */
-
/* Define this macro to control use of the character `$' in identifier names.
The value should be 0, 1, or 2. 0 means `$' is not allowed by default; 1
means it is allowed by default if `-traditional' is used; 2 means it is
diff -rupN gcc.orig/config/i386/i386-protos.h gcc/config/i386/i386-protos.h
--- gcc.orig/config/i386/i386-protos.h Thu Jun 28 07:20:26 2001
+++ gcc/config/i386/i386-protos.h Fri Jun 29 11:22:46 2001
@@ -169,7 +169,6 @@ extern rtx ix86_expand_builtin PARAMS ((
#endif
#ifdef TREE_CODE
-extern int ix86_comp_type_attributes PARAMS ((tree, tree));
extern int ix86_return_pops_args PARAMS ((tree, tree, int));
extern int ix86_data_alignment PARAMS ((tree, int));
diff -rupN gcc.orig/config/i386/i386.c gcc/config/i386/i386.c
--- gcc.orig/config/i386/i386.c Fri Jun 29 09:21:22 2001
+++ gcc/config/i386/i386.c Fri Jun 29 11:23:23 2001
@@ -607,6 +607,7 @@ static int ix86_fp_comparison_sahf_cost
static int ix86_fp_comparison_cost PARAMS ((enum rtx_code code));
static int ix86_save_reg PARAMS ((int, int));
static void ix86_compute_frame_layout PARAMS ((struct ix86_frame *));
+static int ix86_comp_type_attributes PARAMS ((tree, tree));
/* Initialize the GCC target structure. */
#ifdef TARGET_DLLIMPORT_DECL_ATTRIBUTES
@@ -617,6 +618,9 @@ static void ix86_compute_frame_layout PA
#undef TARGET_VALID_TYPE_ATTRIBUTE
#define TARGET_VALID_TYPE_ATTRIBUTE ix86_valid_type_attribute_p
+#undef TARGET_COMP_TYPE_ATTRIBUTES
+#define TARGET_COMP_TYPE_ATTRIBUTES ix86_comp_type_attributes
+
struct gcc_target target = TARGET_INITIALIZER;
/* Sometimes certain combinations of command options do not make
@@ -928,7 +932,7 @@ ix86_valid_type_attribute_p (type, attri
are compatible, and 2 if they are nearly compatible (which causes a
warning to be generated). */
-int
+static int
ix86_comp_type_attributes (type1, type2)
tree type1;
tree type2;
diff -rupN gcc.orig/config/i386/i386.h gcc/config/i386/i386.h
--- gcc.orig/config/i386/i386.h Tue Jun 26 19:14:58 2001
+++ gcc/config/i386/i386.h Fri Jun 29 11:39:52 2001
@@ -2240,19 +2240,6 @@ do \
while (0)
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (ix86_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
-
/* Max number of args passed in registers. If this is more than 3, we will
have problems with ebx (register #4), since it is a caller save register and
is also used as the pic register in ELF. So for now, don't allow more than
diff -rupN gcc.orig/config/m32r/m32r-protos.h gcc/config/m32r/m32r-protos.h
--- gcc.orig/config/m32r/m32r-protos.h Tue Jun 26 19:14:59 2001
+++ gcc/config/m32r/m32r-protos.h Fri Jun 29 11:45:04 2001
@@ -36,12 +36,10 @@ extern void m32r_asm_file_start PARAM
extern void m32r_sched_init PARAMS ((FILE *, int));
extern int direct_return PARAMS ((void));
#ifdef TREE_CODE
-extern int m32r_comp_type_attributes PARAMS ((tree, tree));
extern void m32r_select_section PARAMS ((tree, int));
extern void m32r_encode_section_info PARAMS ((tree));
extern enum m32r_function_type m32r_compute_function_type PARAMS ((tree));
extern void m32r_select_section PARAMS ((tree, int));
-extern void m32r_set_default_type_attributes PARAMS ((tree));
#ifdef HAVE_MACHINE_MODES
extern void m32r_setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, Mmode, tree, int *, int));
diff -rupN gcc.orig/config/m32r/m32r.c gcc/config/m32r/m32r.c
--- gcc.orig/config/m32r/m32r.c Tue Jun 26 19:14:59 2001
+++ gcc/config/m32r/m32r.c Fri Jun 29 11:44:45 2001
@@ -279,26 +279,6 @@ m32r_valid_decl_attribute (type, attribu
return 0;
}
-
-/* Return zero if TYPE1 and TYPE are incompatible, one if they are compatible,
- and two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-m32r_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* Set the default attributes for TYPE. */
-
-void
-m32r_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
-}
/* A C statement or statements to switch to the appropriate
section for output of DECL. DECL is either a `VAR_DECL' node
diff -rupN gcc.orig/config/m32r/m32r.h gcc/config/m32r/m32r.h
--- gcc.orig/config/m32r/m32r.h Tue Jun 26 19:14:59 2001
+++ gcc/config/m32r/m32r.h Fri Jun 29 11:44:56 2001
@@ -2111,16 +2111,6 @@ extern char m32r_punct_chars[];
/* A function address in a call instruction. */
#define FUNCTION_MODE SImode
-
-/* A C expression that returns zero if the attributes on TYPE1 and TYPE2 are
- incompatible, one if they are compatible, and two if they are
- nearly compatible (which causes a warning to be generated). */
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- m32r_comp_type_attributes (TYPE1, TYPE2)
-
-/* Give newly defined TYPE some default attributes. */
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- m32r_set_default_type_attributes (TYPE)
/* Define the information needed to generate branch and scc insns. This is
stored from the compare operation. Note that we can't use "rtx" here
diff -rupN gcc.orig/config/m68hc11/m68hc11-protos.h gcc/config/m68hc11/m68hc11-protos.h
--- gcc.orig/config/m68hc11/m68hc11-protos.h Tue Jun 26 19:14:59 2001
+++ gcc/config/m68hc11/m68hc11-protos.h Fri Jun 29 11:40:47 2001
@@ -43,8 +43,6 @@ extern void m68hc11_function_arg_advance
enum machine_mode,
tree,
int));
-extern int m68hc11_comp_type_attributes PARAMS((tree, tree));
-extern void m68hc11_set_default_type_attributes PARAMS((tree));
extern void m68hc11_encode_section_info PARAMS((tree));
#endif
diff -rupN gcc.orig/config/m68hc11/m68hc11.c gcc/config/m68hc11/m68hc11.c
--- gcc.orig/config/m68hc11/m68hc11.c Tue Jun 26 19:14:59 2001
+++ gcc/config/m68hc11/m68hc11.c Fri Jun 29 11:40:57 2001
@@ -1151,28 +1151,6 @@ m68hc11_valid_type_attribute_p (type, at
return 0;
}
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-m68hc11_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-void
-m68hc11_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
-}
-
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or function
named by the symbol (such as what section it is in).
diff -rupN gcc.orig/config/m68hc11/m68hc11.h gcc/config/m68hc11/m68hc11.h
--- gcc.orig/config/m68hc11/m68hc11.h Tue Jun 26 19:14:59 2001
+++ gcc/config/m68hc11/m68hc11.h Fri Jun 29 11:40:39 2001
@@ -1194,20 +1194,6 @@ typedef struct m68hc11_args
m68hc11_initialize_trampoline ((TRAMP), (FNADDR), (CXT))
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (m68hc11_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- (m68hc11_set_default_type_attributes (TYPE))
-
/* Define this macro if references to a symbol must be treated
differently depending on something about the variable or function
named by the symbol (such as what section it is in).
diff -rupN gcc.orig/config/ns32k/ns32k-protos.h gcc/config/ns32k/ns32k-protos.h
--- gcc.orig/config/ns32k/ns32k-protos.h Tue Jun 26 19:14:59 2001
+++ gcc/config/ns32k/ns32k-protos.h Fri Jun 29 11:31:00 2001
@@ -38,7 +38,6 @@ extern int symbolic_reference_mentioned_
#endif /* RTX_CODE */
#ifdef TREE_CODE
-extern int ns32k_comp_type_attributes PARAMS ((tree, tree));
extern int ns32k_return_pops_args PARAMS ((tree, tree, int));
#endif /* TREE_CODE */
diff -rupN gcc.orig/config/ns32k/ns32k.c gcc/config/ns32k/ns32k.c
--- gcc.orig/config/ns32k/ns32k.c Tue Jun 26 19:14:59 2001
+++ gcc/config/ns32k/ns32k.c Fri Jun 29 11:30:53 2001
@@ -670,18 +670,6 @@ ns32k_valid_type_attribute_p (type, attr
return 0;
}
-/* Return 0 if the attributes for two types are incompatible, 1 if they
- are compatible, and 2 if they are nearly compatible (which causes a
- warning to be generated). */
-
-int
-ns32k_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
/* Value is the number of bytes of arguments automatically
popped when returning from a subroutine call.
diff -rupN gcc.orig/config/ns32k/ns32k.h gcc/config/ns32k/ns32k.h
--- gcc.orig/config/ns32k/ns32k.h Tue Jun 26 19:14:59 2001
+++ gcc/config/ns32k/ns32k.h Fri Jun 29 11:44:34 2001
@@ -1294,19 +1294,6 @@ while (0)
{ if (GET_CODE (ADDR) == POST_INC || GET_CODE (ADDR) == PRE_DEC) \
goto LABEL;}
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (ns32k_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-/* #define SET_DEFAULT_TYPE_ATTRIBUTES (TYPE) */
-
/* Specify the machine mode that this machine uses
for the index in the tablejump instruction.
HI mode is more efficient but the range is not wide enough for
diff -rupN gcc.orig/config/rs6000/rs6000-protos.h gcc/config/rs6000/rs6000-protos.h
--- gcc.orig/config/rs6000/rs6000-protos.h Tue Jun 26 19:14:59 2001
+++ gcc/config/rs6000/rs6000-protos.h Fri Jun 29 11:41:47 2001
@@ -137,8 +137,6 @@ extern void setup_incoming_varargs PARAM
int *, int));
extern struct rtx_def *rs6000_va_arg PARAMS ((tree, tree));
extern void output_mi_thunk PARAMS ((FILE *, tree, int, tree));
-extern int rs6000_comp_type_attributes PARAMS ((tree, tree));
-extern void rs6000_set_default_type_attributes PARAMS ((tree));
extern void rs6000_encode_section_info PARAMS ((tree));
extern void rs6000_select_section PARAMS ((tree, int));
extern void rs6000_unique_section PARAMS ((tree, int));
diff -rupN gcc.orig/config/rs6000/rs6000.c gcc/config/rs6000/rs6000.c
--- gcc.orig/config/rs6000/rs6000.c Tue Jun 26 19:14:59 2001
+++ gcc/config/rs6000/rs6000.c Fri Jun 29 11:41:56 2001
@@ -7853,29 +7853,6 @@ rs6000_valid_type_attribute_p (type, att
return 0;
}
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-int
-rs6000_comp_type_attributes (type1, type2)
- tree type1 ATTRIBUTE_UNUSED;
- tree type2 ATTRIBUTE_UNUSED;
-{
- return 1;
-}
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-void
-rs6000_set_default_type_attributes (type)
- tree type ATTRIBUTE_UNUSED;
-{
- return;
-}
-
/* Return a reference suitable for calling a function with the
longcall attribute. */
struct rtx_def *
diff -rupN gcc.orig/config/rs6000/rs6000.h gcc/config/rs6000/rs6000.h
--- gcc.orig/config/rs6000/rs6000.h Tue Jun 26 19:14:59 2001
+++ gcc/config/rs6000/rs6000.h Fri Jun 29 11:41:41 2001
@@ -1611,21 +1611,6 @@ typedef struct rs6000_args
#define INITIALIZE_TRAMPOLINE(ADDR, FNADDR, CXT) \
rs6000_initialize_trampoline (ADDR, FNADDR, CXT)
-/* If defined, a C expression whose value is zero if the attributes on
- TYPE1 and TYPE2 are incompatible, one if they are compatible, and
- two if they are nearly compatible (which causes a warning to be
- generated). */
-
-#define COMP_TYPE_ATTRIBUTES(TYPE1, TYPE2) \
- (rs6000_comp_type_attributes (TYPE1, TYPE2))
-
-/* If defined, a C statement that assigns default attributes to newly
- defined TYPE. */
-
-#define SET_DEFAULT_TYPE_ATTRIBUTES(TYPE) \
- (rs6000_set_default_type_attributes (TYPE))
-
-
/* Definitions for __builtin_return_address and __builtin_frame_address.
__builtin_return_address (0) should give link register (65), enable
this. */
diff -rupN gcc.orig/cp/typeck.c gcc/cp/typeck.c
--- gcc.orig/cp/typeck.c Tue Jun 26 19:15:02 2001
+++ gcc/cp/typeck.c Fri Jun 29 11:14:28 2001
@@ -996,16 +996,10 @@ comptypes (t1, t2, strict)
if (TYPE_MAIN_VARIANT (t1) == TYPE_MAIN_VARIANT (t2))
return 1;
- /* ??? COMP_TYPE_ATTRIBUTES is currently useless for variables as each
- attribute is its own main variant (`val' will remain 0). */
-#ifndef COMP_TYPE_ATTRIBUTES
-#define COMP_TYPE_ATTRIBUTES(t1,t2) 1
-#endif
-
if (strict & COMPARE_NO_ATTRIBUTES)
attrval = 1;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
- else if (! (attrval = COMP_TYPE_ATTRIBUTES (t1, t2)))
+ else if (! (attrval = (*target.comp_type_attributes) (t1, t2)))
return 0;
/* 1 if no need for warning yet, 2 if warning cause has been seen. */
diff -rupN gcc.orig/doc/tm.texi gcc/doc/tm.texi
--- gcc.orig/doc/tm.texi Thu Jun 28 07:20:26 2001
+++ gcc/doc/tm.texi Fri Jun 29 11:38:26 2001
@@ -8299,19 +8299,18 @@ arguments @var{args} is a valid machine
The attributes in @var{attributes} have previously been assigned to @var{type}.
@end deftypefn
-@table @code
-@findex COMP_TYPE_ATTRIBUTES
-@item COMP_TYPE_ATTRIBUTES (@var{type1}, @var{type2})
-If defined, a C expression whose value is zero if the attributes on
+@deftypefn {Target Hook} int TARGET_COMP_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
+If defined, this target hook is a function which returns zero if the attributes on
@var{type1} and @var{type2} are incompatible, one if they are compatible,
and two if they are nearly compatible (which causes a warning to be
-generated).
+generated). If this is not defined, machine-specific attributes are
+supposed always to be compatible.
+@end deftypefn
-@findex SET_DEFAULT_TYPE_ATTRIBUTES
-@item SET_DEFAULT_TYPE_ATTRIBUTES (@var{type})
-If defined, a C statement that assigns default attributes to
+@deftypefn {Target Hook} void TARGET_SET_DEFAULT_TYPE_ATTRIBUTES (tree @var{type})
+If defined, this target hook is a function which assigns default attributes to
newly defined @var{type}.
-@end table
+@end deftypefn
@deftypefn {Target Hook} tree TARGET_MERGE_TYPE_ATTRIBUTES (tree @var{type1}, tree @var{type2})
Define this target hook if the merging of type attributes needs special
diff -rupN gcc.orig/target-def.h gcc/target-def.h
--- gcc.orig/target-def.h Wed Jun 27 21:24:51 2001
+++ gcc/target-def.h Fri Jun 29 12:03:42 2001
@@ -30,6 +30,8 @@ Foundation, 59 Temple Place - Suite 330,
#define TARGET_MERGE_TYPE_ATTRIBUTES merge_type_attributes
#define TARGET_VALID_DECL_ATTRIBUTE default_valid_attribute_p
#define TARGET_VALID_TYPE_ATTRIBUTE default_valid_attribute_p
+#define TARGET_COMP_TYPE_ATTRIBUTES default_comp_type_attributes
+#define TARGET_SET_DEFAULT_TYPE_ATTRIBUTES default_set_default_type_attributes
/* The whole shebang. */
#define TARGET_INITIALIZER \
@@ -37,5 +39,7 @@ Foundation, 59 Temple Place - Suite 330,
TARGET_MERGE_DECL_ATTRIBUTES, \
TARGET_MERGE_TYPE_ATTRIBUTES, \
TARGET_VALID_DECL_ATTRIBUTE, \
- TARGET_VALID_TYPE_ATTRIBUTE \
+ TARGET_VALID_TYPE_ATTRIBUTE, \
+ TARGET_COMP_TYPE_ATTRIBUTES, \
+ TARGET_SET_DEFAULT_TYPE_ATTRIBUTES \
}
diff -rupN gcc.orig/target.h gcc/target.h
--- gcc.orig/target.h Wed Jun 27 21:24:51 2001
+++ gcc/target.h Fri Jun 29 12:03:47 2001
@@ -63,6 +63,14 @@ struct gcc_target
previously been assigned to TYPE. */
int (* valid_type_attribute) PARAMS ((tree type, tree attributes,
tree identifier, tree args));
+
+ /* Return zero if the attributes on TYPE1 and TYPE2 are incompatible,
+ one if they are compatible and two if they are nearly compatible
+ (which causes a warning to be generated). */
+ int (* comp_type_attributes) PARAMS ((tree type1, tree type2));
+
+ /* Assign default attributes to the newly defined TYPE. */
+ void (* set_default_type_attributes) PARAMS ((tree type));
};
extern struct gcc_target target;
diff -rupN gcc.orig/tree.c gcc/tree.c
--- gcc.orig/tree.c Wed Jun 27 07:19:06 2001
+++ gcc/tree.c Fri Jun 29 11:43:25 2001
@@ -433,9 +433,7 @@ make_node (code)
TYPE_USER_ALIGN (t) = 0;
TYPE_MAIN_VARIANT (t) = t;
TYPE_ATTRIBUTES (t) = NULL_TREE;
-#ifdef SET_DEFAULT_TYPE_ATTRIBUTES
- SET_DEFAULT_TYPE_ATTRIBUTES (t);
-#endif
+ (* target.set_default_type_attributes) (t);
/* Note that we have not yet computed the alias set for this
type. */
TYPE_ALIAS_SET (t) = -1;
@@ -2718,6 +2716,25 @@ default_valid_attribute_p PARAMS ((attr_
tree type ATTRIBUTE_UNUSED;
{
return 0;
+}
+
+/* Default value of target.comp_type_attributes that always returns 1. */
+
+int
+default_comp_type_attributes (type1, type2)
+ tree type1 ATTRIBUTE_UNUSED;
+ tree type2 ATTRIBUTE_UNUSED;
+{
+ return 1;
+}
+
+/* Default version of target.set_default_type_attributes that always does
+ nothing. */
+
+void
+default_set_default_type_attributes (type)
+ tree type ATTRIBUTE_UNUSED;
+{
}
/* Return 1 if ATTR_NAME and ATTR_ARGS is valid for either declaration
diff -rupN gcc.orig/tree.h gcc/tree.h
--- gcc.orig/tree.h Fri Jun 29 09:21:21 2001
+++ gcc/tree.h Fri Jun 29 11:42:27 2001
@@ -2044,6 +2044,8 @@ extern tree build_decl_attribute_variant
extern tree merge_decl_attributes PARAMS ((tree, tree));
extern tree merge_type_attributes PARAMS ((tree, tree));
extern int default_valid_attribute_p PARAMS ((tree, tree, tree, tree));
+extern int default_comp_type_attributes PARAMS ((tree, tree));
+extern void default_set_default_type_attributes PARAMS ((tree));
/* Split a list of declspecs and attributes into two. */
--
Joseph S. Myers
jsm28@cam.ac.uk