From: Joseph Myers Date: Fri, 29 Jun 2001 17:21:16 +0000 (+0100) Subject: target.h (struct gcc_target): Add comp_type_attributes and set_default_type_attributes. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8d8e52be8aeb3b679baac38d41cbc07448a44ac7;p=gcc.git target.h (struct gcc_target): Add comp_type_attributes and set_default_type_attributes. * target.h (struct gcc_target): Add comp_type_attributes 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: * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define. (comptypes): Use target.comp_type_attributes. From-SVN: r43655 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 8ced79461e6..ce064e99072 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,59 @@ +2001-06-29 Joseph S. Myers + + * target.h (struct gcc_target): Add comp_type_attributes 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. + 2001-06-28 Jan van Male * predict.c (dump_prediction): Eliminate fprintf warning. diff --git a/gcc/c-typeck.c b/gcc/c-typeck.c index 1a9ed5fe06b..bc9de485a3f 100644 --- a/gcc/c-typeck.c +++ b/gcc/c-typeck.c @@ -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 --git a/gcc/config/arc/arc-protos.h b/gcc/config/arc/arc-protos.h index e550e68a225..b264d632364 100644 --- a/gcc/config/arc/arc-protos.h +++ b/gcc/config/arc/arc-protos.h @@ -60,8 +60,6 @@ extern int shift_operator PARAMS ((rtx, enum machine_mode)); #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 --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c index c5c910690c9..c579cd5f9b7 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -342,24 +342,6 @@ arc_valid_decl_attribute (type, attributes, identifier, args) 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 --git a/gcc/config/arc/arc.h b/gcc/config/arc/arc.h index 4a78213a58e..80ad885d806 100644 --- a/gcc/config/arc/arc.h +++ b/gcc/config/arc/arc.h @@ -1575,16 +1575,6 @@ do { if ((LOG) != 0) fprintf (FILE, "\t.align %d\n", 1 << (LOG)); } while (0) /* 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 --git a/gcc/config/arm/arm-protos.h b/gcc/config/arm/arm-protos.h index 2d3ee1a77d7..653d788ded3 100644 --- a/gcc/config/arm/arm-protos.h +++ b/gcc/config/arm/arm-protos.h @@ -38,8 +38,6 @@ extern unsigned long arm_current_func_type PARAMS ((void)); #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 --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c index b673534525b..97ca596b3f8 100644 --- a/gcc/config/arm/arm.c +++ b/gcc/config/arm/arm.c @@ -106,6 +106,8 @@ static int arm_valid_type_attribute_p PARAMS ((tree, tree, 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 PARAMS ((tree, tree, # 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, attributes, identifier, args) /* 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 --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h index 88997d79066..a4dff6dc6cc 100644 --- a/gcc/config/arm/arm.h +++ b/gcc/config/arm/arm.h @@ -2542,18 +2542,6 @@ extern const char * arm_pic_register_string; 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 --git a/gcc/config/d30v/d30v.h b/gcc/config/d30v/d30v.h index f072cfb96f8..2b08b117c89 100644 --- a/gcc/config/d30v/d30v.h +++ b/gcc/config/d30v/d30v.h @@ -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 --git a/gcc/config/i386/i386-protos.h b/gcc/config/i386/i386-protos.h index af1b345b293..dfb2bccfa2c 100644 --- a/gcc/config/i386/i386-protos.h +++ b/gcc/config/i386/i386-protos.h @@ -169,7 +169,6 @@ extern rtx ix86_expand_builtin PARAMS ((tree, rtx, rtx, enum machine_mode, int)) #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 --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 3d702ea3f3c..b4aab6beac2 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -607,6 +607,7 @@ static int ix86_fp_comparison_sahf_cost PARAMS ((enum rtx_code code)); 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 PARAMS ((struct ix86_frame *)); #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, attributes, identifier, args) 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 --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index 177e1321e37..bb77de3fdb5 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -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 --git a/gcc/config/m32r/m32r-protos.h b/gcc/config/m32r/m32r-protos.h index 5ab4a4ce1a6..a73b312158d 100644 --- a/gcc/config/m32r/m32r-protos.h +++ b/gcc/config/m32r/m32r-protos.h @@ -36,12 +36,10 @@ extern void m32r_asm_file_start PARAMS ((FILE *)); 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 --git a/gcc/config/m32r/m32r.c b/gcc/config/m32r/m32r.c index a7763a2c25c..6530435c8c8 100644 --- a/gcc/config/m32r/m32r.c +++ b/gcc/config/m32r/m32r.c @@ -279,26 +279,6 @@ m32r_valid_decl_attribute (type, attributes, identifier, args) 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 --git a/gcc/config/m32r/m32r.h b/gcc/config/m32r/m32r.h index 8600e6ed703..dfe4f289da7 100644 --- a/gcc/config/m32r/m32r.h +++ b/gcc/config/m32r/m32r.h @@ -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 --git a/gcc/config/m68hc11/m68hc11-protos.h b/gcc/config/m68hc11/m68hc11-protos.h index 8c659b0571e..b31770b9c77 100644 --- a/gcc/config/m68hc11/m68hc11-protos.h +++ b/gcc/config/m68hc11/m68hc11-protos.h @@ -43,8 +43,6 @@ extern void m68hc11_function_arg_advance PARAMS((CUMULATIVE_ARGS*, 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 --git a/gcc/config/m68hc11/m68hc11.c b/gcc/config/m68hc11/m68hc11.c index 906c368f00a..1d7669736e8 100644 --- a/gcc/config/m68hc11/m68hc11.c +++ b/gcc/config/m68hc11/m68hc11.c @@ -1151,28 +1151,6 @@ m68hc11_valid_type_attribute_p (type, attributes, identifier, args) 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 --git a/gcc/config/m68hc11/m68hc11.h b/gcc/config/m68hc11/m68hc11.h index e9c38dea0b2..5af1db2112a 100644 --- a/gcc/config/m68hc11/m68hc11.h +++ b/gcc/config/m68hc11/m68hc11.h @@ -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 --git a/gcc/config/ns32k/ns32k-protos.h b/gcc/config/ns32k/ns32k-protos.h index 7c6da1bbca0..64b484b5f5a 100644 --- a/gcc/config/ns32k/ns32k-protos.h +++ b/gcc/config/ns32k/ns32k-protos.h @@ -38,7 +38,6 @@ extern int symbolic_reference_mentioned_p PARAMS ((rtx)); #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 --git a/gcc/config/ns32k/ns32k.c b/gcc/config/ns32k/ns32k.c index ec5470a05c2..22a4b49b88e 100644 --- a/gcc/config/ns32k/ns32k.c +++ b/gcc/config/ns32k/ns32k.c @@ -670,18 +670,6 @@ ns32k_valid_type_attribute_p (type, attributes, identifier, args) 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 --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index e92140b7973..3adc9bbd1b7 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -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 --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index cbcd2574633..41124437121 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -137,8 +137,6 @@ extern void setup_incoming_varargs PARAMS ((CUMULATIVE_ARGS *, 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 --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index 45e6bd40d06..2ef989ed44b 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -7853,29 +7853,6 @@ rs6000_valid_type_attribute_p (type, attributes, identifier, args) 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 --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index ad4768fdab8..1a569045255 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -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 --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 62e1f4afb5b..2b55f03b64e 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,8 @@ +2001-06-29 Joseph S. Myers + + * typeck.c (COMP_TYPE_ATTRIBUTES): Don't define. + (comptypes): Use target.comp_type_attributes. + 2001-06-29 Nathan Sidwell * cp-tree.h (flag_dump_class_layout): Remove unneeded declaration. diff --git a/gcc/cp/typeck.c b/gcc/cp/typeck.c index db1044adeee..cb1146ef7d3 100644 --- a/gcc/cp/typeck.c +++ b/gcc/cp/typeck.c @@ -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 --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 991672cd353..236b98dcf3c 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -8299,19 +8299,18 @@ arguments @var{args} is a valid machine specific attribute for @var{type}. 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 --git a/gcc/target-def.h b/gcc/target-def.h index 78fd30f6f23..35c2ce8f5bb 100644 --- a/gcc/target-def.h +++ b/gcc/target-def.h @@ -30,6 +30,8 @@ Foundation, 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #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, Boston, MA 02111-1307, USA. 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 --git a/gcc/target.h b/gcc/target.h index 6e97ee7f21f..efdb5846ac1 100644 --- a/gcc/target.h +++ b/gcc/target.h @@ -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 --git a/gcc/tree.c b/gcc/tree.c index 6860e06887f..04d46477bff 100644 --- a/gcc/tree.c +++ b/gcc/tree.c @@ -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; @@ -2720,6 +2718,25 @@ default_valid_attribute_p PARAMS ((attr_name, attr_args, decl, type)) 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 DECL or type TYPE and 0 otherwise. Validity is determined the target functions valid_decl_attribute and valid_machine_attribute. */ diff --git a/gcc/tree.h b/gcc/tree.h index 4f8dbef44eb..9a5fb6a5137 100644 --- a/gcc/tree.h +++ b/gcc/tree.h @@ -2044,6 +2044,8 @@ extern tree build_decl_attribute_variant PARAMS ((tree, tree)); 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. */