* target.h (struct gcc_target): Add insert_attributes.
* target-def.h (TARGET_INSERT_ATTRIBUTES): Define.
(TARGET_INITIALIZER): Update.
* tree.c, tree.h (default_insert_attributes): New function.
Update comments on other default functions to refer to targetm,
not target.
* doc/tm.texi (INSERT_ATTRIBUTES): Update to document
TARGET_INSERT_ATTRIBUTES.
(SET_DEFAULT_DECL_ATTRIBUTES): Remove.
* c-common.c (decl_attributes): Use targetm.insert_attributes.
Don't use PRAGMA_INSERT_ATTRIBUTES.
* Makefile.in (c-common.o): Depend on $(TARGET_H).
* c-decl.c (start_decl, start_function): Don't call
SET_DEFAULT_DECL_ATTRIBUTES.
* config/c4x/c4x.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define.
* config/c4x/c4x-protos.h (c4x_set_default_attributes): Don't
declare.
* config/c4x/c4x.c (TARGET_INSERT_ATTRIBUTES): Define.
(c4x_check_attribute): Avoid modifying attribute list itself.
(c4x_set_default_attributes): Rename to c4x_insert_attributes.
Make static.
* config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Don't define.
* config/sh/sh-protos.h (sh_pragma_insert_attributes): Don't
declare.
* config/sh/sh.c (TARGET_INSERT_ATTRIBUTES): Define.
(sh_pragma_insert_attributes): Rename to sh_insert_attributes.
Make static.
* config/v850/v850.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define.
* config/v850/v850-protos.h (v850_set_default_decl_attr): Don't
declare.
* config/v850/v850.c (TARGET_INSERT_ATTRIBUTES): Define.
(v850_set_default_decl_attr): Rename to v850_insert_attributes.
Adjust parameters. Make static.
cp:
* decl.c (start_decl): Don't call SET_DEFAULT_DECL_ATTRIBUTES.
(start_function): Don't call SET_DEFAULT_DECL_ATTRIBUTES. Call
cplus_decl_attributes even if attrs is NULL.
* friend.c (do_friend): Don't call SET_DEFAULT_DECL_ATTRIBUTES.
From-SVN: r43851
+2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * target.h (struct gcc_target): Add insert_attributes.
+ * target-def.h (TARGET_INSERT_ATTRIBUTES): Define.
+ (TARGET_INITIALIZER): Update.
+ * tree.c, tree.h (default_insert_attributes): New function.
+ Update comments on other default functions to refer to targetm,
+ not target.
+ * doc/tm.texi (INSERT_ATTRIBUTES): Update to document
+ TARGET_INSERT_ATTRIBUTES.
+ (SET_DEFAULT_DECL_ATTRIBUTES): Remove.
+ * c-common.c (decl_attributes): Use targetm.insert_attributes.
+ Don't use PRAGMA_INSERT_ATTRIBUTES.
+ * Makefile.in (c-common.o): Depend on $(TARGET_H).
+ * c-decl.c (start_decl, start_function): Don't call
+ SET_DEFAULT_DECL_ATTRIBUTES.
+ * config/c4x/c4x.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define.
+ * config/c4x/c4x-protos.h (c4x_set_default_attributes): Don't
+ declare.
+ * config/c4x/c4x.c (TARGET_INSERT_ATTRIBUTES): Define.
+ (c4x_check_attribute): Avoid modifying attribute list itself.
+ (c4x_set_default_attributes): Rename to c4x_insert_attributes.
+ Make static.
+ * config/sh/sh.h (PRAGMA_INSERT_ATTRIBUTES): Don't define.
+ * config/sh/sh-protos.h (sh_pragma_insert_attributes): Don't
+ declare.
+ * config/sh/sh.c (TARGET_INSERT_ATTRIBUTES): Define.
+ (sh_pragma_insert_attributes): Rename to sh_insert_attributes.
+ Make static.
+ * config/v850/v850.h (SET_DEFAULT_DECL_ATTRIBUTES): Don't define.
+ * config/v850/v850-protos.h (v850_set_default_decl_attr): Don't
+ declare.
+ * config/v850/v850.c (TARGET_INSERT_ATTRIBUTES): Define.
+ (v850_set_default_decl_attr): Rename to v850_insert_attributes.
+ Adjust parameters. Make static.
+
2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
* c-common.c (decl_attributes): Only take a single attributes
c-common.o : c-common.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) $(OBSTACK_H) \
$(C_COMMON_H) flags.h toplev.h output.h c-pragma.h $(RTL_H) $(GGC_H) \
- $(EXPR_H) $(TM_P_H) builtin-types.def
+ $(EXPR_H) $(TM_P_H) builtin-types.def $(TARGET_H)
c-format.o : c-format.c $(CONFIG_H) $(SYSTEM_H) $(TREE_H) \
$(C_COMMON_H) flags.h toplev.h intl.h diagnostic.h
#include "tm_p.h"
#include "obstack.h"
#include "cpplib.h"
+#include "target.h"
cpp_reader *parse_in; /* Declared in c-lex.h. */
#undef WCHAR_TYPE_SIZE
else if (TYPE_P (node))
type = node, is_type = 1;
-#ifdef PRAGMA_INSERT_ATTRIBUTES
- /* If the code in c-pragma.c wants to insert some attributes then
- allow it to do so. Do this before allowing machine back ends to
- insert attributes, so that they have the opportunity to override
- anything done here. */
- PRAGMA_INSERT_ATTRIBUTES (node, & attributes);
-#endif
-
-#ifdef INSERT_ATTRIBUTES
- INSERT_ATTRIBUTES (node, & attributes);
-#endif
+ (*targetm.insert_attributes) (node, &attributes);
for (a = attributes; a; a = TREE_CHAIN (a))
{
if (! flag_no_common || ! TREE_PUBLIC (decl))
DECL_COMMON (decl) = 1;
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes);
-#endif
-
/* Set attributes here so if duplicate decl, will have proper attributes. */
decl_attributes (decl, attributes);
except for defining how to inline. So set DECL_EXTERNAL in that case. */
DECL_EXTERNAL (decl1) = current_extern_inline;
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl1, attributes);
-#endif
-
/* This function exists in static storage.
(This does not mean `static' in the C sense!) */
TREE_STATIC (decl1) = 1;
extern void c4x_file_end (FILE *);
#ifdef TREE_CODE
-extern void c4x_set_default_attributes PARAMS ((tree, tree *));
-
extern void c4x_function_arg_advance PARAMS ((CUMULATIVE_ARGS *,
enum machine_mode, tree, int));
static int c4x_rptb_valid_p PARAMS ((rtx, rtx));
static int c4x_label_ref_used_p PARAMS ((rtx, rtx));
static int c4x_valid_type_attribute_p PARAMS ((tree, tree, tree, tree));
+static void c4x_insert_attributes PARAMS ((tree, tree *));
\f
/* Initialize the GCC target structure. */
#undef TARGET_VALID_TYPE_ATTRIBUTE
#define TARGET_VALID_TYPE_ATTRIBUTE c4x_valid_type_attribute_p
+#undef TARGET_INSERT_ATTRIBUTES
+#define TARGET_INSERT_ATTRIBUTES c4x_insert_attributes
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
/* Called to register all of our global variables with the garbage
!= IDENTIFIER_POINTER (DECL_NAME (decl)))
list = TREE_CHAIN (list);
if (list)
- *attributes = chainon (*attributes,
- build_tree_list (get_identifier (attrib),
- TREE_VALUE (list)));
+ *attributes = tree_cons (get_identifier (attrib), TREE_VALUE (list),
+ *attributes);
}
-void
-c4x_set_default_attributes(decl, attributes)
+static void
+c4x_insert_attributes (decl, attributes)
tree decl, *attributes;
{
switch (TREE_CODE (decl))
c4x_init_pragma (&c_lex); \
} while (0)
-#define SET_DEFAULT_DECL_ATTRIBUTES(DECL, ATTRIBUTES) \
- c4x_set_default_attributes (DECL, &ATTRIBUTES)
-
/* Assembler Commands for Alignment. */
#define ASM_OUTPUT_SKIP(FILE, SIZE) \
#endif /* RTX_CODE */
#ifdef TREE_CODE
-extern void sh_pragma_insert_attributes PARAMS ((tree, tree *));
extern tree sh_build_va_list PARAMS ((void));
#endif /* TREE_CODE */
static rtx mark_constant_pool_use PARAMS ((rtx));
static int sh_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
static void sh_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
+static void sh_insert_attributes PARAMS ((tree, tree *));
\f
/* Initialize the GCC target structure. */
#undef TARGET_VALID_DECL_ATTRIBUTE
#undef TARGET_ASM_FUNCTION_EPILOGUE
#define TARGET_ASM_FUNCTION_EPILOGUE sh_output_function_epilogue
+#undef TARGET_INSERT_ATTRIBUTES
+#define TARGET_INSERT_ATTRIBUTES sh_insert_attributes
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
/* Print the operand address in x to the stream. */
/* Generate 'handle_interrupt' attribute for decls */
-void
-sh_pragma_insert_attributes (node, attributes)
+static void
+sh_insert_attributes (node, attributes)
tree node;
tree * attributes;
{
for interrupt functions. */
extern struct rtx_def *sp_switch;
-#define PRAGMA_INSERT_ATTRIBUTES(node, pattr) \
- sh_pragma_insert_attributes (node, pattr)
-
extern int rtx_equal_function_value_matters;
extern struct rtx_def *fpscr_rtx;
#ifdef TREE_CODE
extern void v850_encode_data_area PARAMS ((tree));
-extern void v850_set_default_decl_attr PARAMS ((tree));
extern int v850_interrupt_function_p PARAMS ((tree));
extern void v850_output_aligned_bss PARAMS ((FILE *, tree, const char *, int, int));
extern void v850_output_common PARAMS ((FILE *, tree, const char *, int, int));
static int ep_memory_offset PARAMS ((enum machine_mode, int));
static void v850_set_data_area PARAMS ((tree, v850_data_area));
static int v850_valid_decl_attribute PARAMS ((tree, tree, tree, tree));
+static void v850_insert_attributes PARAMS ((tree, tree *));
/* True if the current function has anonymous arguments. */
int current_function_anonymous_args;
#undef TARGET_VALID_DECL_ATTRIBUTE
#define TARGET_VALID_DECL_ATTRIBUTE v850_valid_decl_attribute
+#undef TARGET_INSERT_ATTRIBUTES
+#define TARGET_INSERT_ATTRIBUTES v850_insert_attributes
+
struct gcc_target targetm = TARGET_INITIALIZER;
\f
/* Sometimes certain combinations of command options do not make
/* Add data area to the given declaration if a ghs data area pragma is
currently in effect (#pragma ghs startXXX/endXXX). */
-void
-v850_set_default_decl_attr (decl)
+static void
+v850_insert_attributes (decl, attr_ptr)
tree decl;
+ tree *attr_ptr ATTRIBUTE_UNUSED;
{
if (data_area_stack
&& data_area_stack->data_area
so give the MEM rtx a byte's mode. */
#define FUNCTION_MODE QImode
-/* A C statement that assigns default attributes to a newly created DECL. */
-#define SET_DEFAULT_DECL_ATTRIBUTES(decl, attr) \
- v850_set_default_decl_attr (decl)
-
/* Tell compiler we want to support GHS pragmas */
#define REGISTER_TARGET_PRAGMAS(PFILE) do { \
cpp_register_pragma_space (PFILE, "ghs"); \
+2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
+
+ * decl.c (start_decl): Don't call SET_DEFAULT_DECL_ATTRIBUTES.
+ (start_function): Don't call SET_DEFAULT_DECL_ATTRIBUTES. Call
+ cplus_decl_attributes even if attrs is NULL.
+ * friend.c (do_friend): Don't call SET_DEFAULT_DECL_ATTRIBUTES.
+
2001-07-08 Joseph S. Myers <jsm28@cam.ac.uk>
* decl.c (grokdeclarator), decl2.c (cplus_decl_attributes): Update
DECL_INITIAL (decl) = error_mark_node;
}
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes);
-#endif
-
/* Set attributes here so if duplicate decl, will have proper attributes. */
cplus_decl_attributes (decl, attributes, prefix_attributes);
if (!DECL_INITIAL (decl1))
DECL_INITIAL (decl1) = error_mark_node;
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl1, attrs);
-#endif
-
/* This function exists in static storage.
(This does not mean `static' in the C sense!) */
TREE_STATIC (decl1) = 1;
pushlevel (0);
current_binding_level->parm_flag = 1;
- if (attrs)
- cplus_decl_attributes (decl1, NULL_TREE, attrs);
+ cplus_decl_attributes (decl1, NULL_TREE, attrs);
/* Promote the value to int before returning it. */
if (c_promoting_integer_type_p (restype))
prefix_attributes = NULL_TREE;
}
-#ifdef SET_DEFAULT_DECL_ATTRIBUTES
- SET_DEFAULT_DECL_ATTRIBUTES (decl, attributes);
-#endif
-
/* Set attributes here so if duplicate decl, will have proper attributes. */
cplus_decl_attributes (decl, attributes, prefix_attributes);
in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
@end deftypefn
-@table @code
-@findex INSERT_ATTRIBUTES
-@item INSERT_ATTRIBUTES (@var{node}, @var{attr_ptr})
-Define this macro if you want to be able to add attributes to a decl
+@deftypefn {Target Hook} void TARGET_INSERT_ATTRIBUTES (tree @var{node}, tree *@var{attr_ptr})
+Define this target hook if you want to be able to add attributes to a decl
when it is being created. This is normally useful for back ends which
wish to implement a pragma by using the attributes which correspond to
the pragma's effect. The @var{node} argument is the decl which is being
the list and @code{*@var{attr_ptr}} modified to point to the new
attributes, or a copy of the list may be made if further changes are
needed.
+@end deftypefn
-@findex SET_DEFAULT_DECL_ATTRIBUTES
-@item SET_DEFAULT_DECL_ATTRIBUTES (@var{decl}, @var{attributes})
-If defined, a C statement that assigns default attributes to
-newly defined @var{decl}.
-
+@table @code
@findex DOLLARS_IN_IDENTIFIERS
@item DOLLARS_IN_IDENTIFIERS
Define this macro to control use of the character @samp{$} in identifier
#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
+#define TARGET_INSERT_ATTRIBUTES default_insert_attributes
/* The whole shebang. */
#define TARGET_INITIALIZER \
TARGET_VALID_DECL_ATTRIBUTE, \
TARGET_VALID_TYPE_ATTRIBUTE, \
TARGET_COMP_TYPE_ATTRIBUTES, \
- TARGET_SET_DEFAULT_TYPE_ATTRIBUTES \
+ TARGET_SET_DEFAULT_TYPE_ATTRIBUTES, \
+ TARGET_INSERT_ATTRIBUTES \
}
/* Assign default attributes to the newly defined TYPE. */
void (* set_default_type_attributes) PARAMS ((tree type));
+
+ /* Insert attributes on the newly created DECL. */
+ void (* insert_attributes) PARAMS ((tree decl, tree *attributes));
};
extern struct gcc_target targetm;
return ttype;
}
-/* Default value of target.valid_decl_attribute_p and
- target.valid_type_attribute_p that always returns false. */
+/* Default value of targetm.valid_decl_attribute_p and
+ targetm.valid_type_attribute_p that always returns false. */
int
default_valid_attribute_p PARAMS ((attr_name, attr_args, decl, type))
return 0;
}
-/* Default value of target.comp_type_attributes that always returns 1. */
+/* Default value of targetm.comp_type_attributes that always returns 1. */
int
default_comp_type_attributes (type1, type2)
return 1;
}
-/* Default version of target.set_default_type_attributes that always does
+/* Default version of targetm.set_default_type_attributes that always does
nothing. */
void
{
}
+/* Default version of targetm.insert_attributes that always does nothing. */
+void
+default_insert_attributes (decl, attr_ptr)
+ tree decl ATTRIBUTE_UNUSED;
+ tree *attr_ptr 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. */
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));
+extern void default_insert_attributes PARAMS ((tree, tree *));
/* Split a list of declspecs and attributes into two. */