* system.h (TARGET_ESC): Move to ...
* defaults.h (TARGET_ESC): ... here.
* target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
TARGET_VALID_TYPE_ATTRIBUTE): Default to a no-op handler.
* tree.c (default_valid_attribute_p): New.
(valid_machine_attribute): Handlers can not be NULL.
* tree.h (default_valid_attribute_p): New.
* doc/tm.texi: Document TARGET_ESC.
* cp/decl2.c (import_export_class): Update.
From-SVN: r43605
+2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk>
+
+ * system.h (TARGET_ESC): Move to ...
+ * defaults.h (TARGET_ESC): ... here.
+ * target-def.h (TARGET_VALID_DECL_ATTRIBUTE,
+ TARGET_VALID_TYPE_ATTRIBUTE): Default to a no-op handler.
+ * tree.c (default_valid_attribute_p): New.
+ (valid_machine_attribute): Handlers can not be NULL.
+ * tree.h (default_valid_attribute_p): New.
+ * doc/tm.texi: Document TARGET_ESC.
+ * cp/decl2.c (import_export_class): Update.
+
2001-06-26 Bruce Korb <bkorb@gnu.org>
* gcc/fixinc/fixincl.c(initialize): In very strict ANSI, you cannot
+2001-06-27 Neil Booth <neil@cat.daikokuya.demon.co.uk>
+
+ * decl2.c (import_export_class): Update.
+
2001-06-26 Gabriel Dos Reis <gdr@codesourcery.com>
* error.c (init_error): Adjust settings.
if (CLASSTYPE_INTERFACE_ONLY (ctype))
return;
- if (target.valid_type_attribute != NULL)
- {
- /* FIXME this should really use some sort of target-independent
- macro. */
- if (lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype)))
- import_export = -1;
- else if (lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype)))
- import_export = 1;
- }
+ if ((*target.valid_type_attribute) (ctype,
+ TYPE_ATTRIBUTES (ctype),
+ get_identifier ("dllimport"),
+ NULL_TREE)
+ && lookup_attribute ("dllimport", TYPE_ATTRIBUTES (ctype)))
+ import_export = -1;
+ else if ((*target.valid_type_attribute) (ctype,
+ TYPE_ATTRIBUTES (ctype),
+ get_identifier ("dllexport"),
+ NULL_TREE)
+ && lookup_attribute ("dllexport", TYPE_ATTRIBUTES (ctype)))
+ import_export = 1;
/* If we got -fno-implicit-templates, we import template classes that
weren't explicitly instantiated. */
# define TARGET_VT 013
# define TARGET_FF 014
# define TARGET_CR 015
+# define TARGET_ESC 033
#endif
/* Store in OUTPUT a string (made with alloca) containing
In addition to the file @file{@var{machine}.md}, a machine description
includes a C header file conventionally given the name
+<<<<<<< tm.texi
+@file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
+The header file defines numerous macros that convey the information
+about the target machine that does not fit into the scheme of the
+@file{.md} file. The file @file{tm.h} should be a link to
+@file{@var{machine}.h}. The header file @file{config.h} includes
+@file{tm.h} and most compiler source files include @file{config.h}. The
+source file defines a variable @code{target}, which is a structure
+containing pointers to functions and data relating to the target
+machine. @file{@var{machine}.c} should also their definitions, if they
+are not defined elsewhere in GCC, and other functions called through the
+macros defined in the @file{.h} file.
+=======
@file{@var{machine}.h} and a C source file named @file{@var{machine}.c}.
The header file defines numerous macros that convey the information
about the target machine that does not fit into the scheme of the
machine. @file{@var{machine}.c} should also contain their definitions,
if they are not defined elsewhere in GCC, and other functions called
through the macros defined in the @file{.h} file.
+>>>>>>> 1.11
@menu
* Target Structure:: The @code{target} variable.
A C constant expression for the integer value for escape sequence
@samp{\a}.
+@findex TARGET_ESC
+@item TARGET_ESC
+A C constant expression for the integer value of the target escape
+character. As an extension, GCC evaluates the escape sequences
+@samp{\e} and @samp{\E} to this.
+
@findex TARGET_TAB
@findex TARGET_BS
@findex TARGET_NEWLINE
newly defined @var{type}.
@end table
+<<<<<<< tm.texi
+@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
+handling. If defined, the result is a list of the combined
+@code{TYPE_ATTRIBUTES} of @var{type1} and @var{type2}. It is assumed
+that @code{comptypes} has already been called and returned 1. This
+function may call @code{merge_attributes} to handle machine-independent
+merging.
+@end deftypefn
+
+@deftypefn {Target Hook} tree TARGET_MERGE_DECL_ATTRIBUTES (tree @var{olddecl}, tree @var{newdecl})
+Define this target hook if the merging of decl attributes needs special
+handling. If defined, the result is a list of the combined
+@code{DECL_MACHINE_ATTRIBUTES} of @var{olddecl} and @var{newdecl}.
+@var{newdecl} is a duplicate declaration of @var{olddecl}. Examples of
+when this is needed are when one attribute overrides another, or when an
+attribute is nullified by a subsequent definition. This function may
+call @code{merge_attributes} to handle machine-independent merging.
+
+If the only target-specific handling you require is @samp{dllimport} for
+Windows targets, you should define the macro
+@code{TARGET_DLLIMPORT_DECL_ATTRIBUTES}. This links in a function
+called @code{merge_dllimport_decl_attributes} which you can then define
+as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. This is done
+in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
+@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
handling. If defined, the result is a list of the combined
as the expansion of @code{TARGET_MERGE_DECL_ATTRIBUTES}. This is done
in @file{i386/cygwin.h} and @file{i386/i386.c}, for example.
@end deftypefn
+>>>>>>> 1.11
@table @code
@findex INSERT_ATTRIBUTES
replacement instead. */
#include <safe-ctype.h>
-/* Define a default escape character; it's different for EBCDIC. */
-#ifndef TARGET_ESC
-#define TARGET_ESC 033
-#endif
-
#include <sys/types.h>
#include <errno.h>
return ttype;
}
+/* Default value of target.valid_decl_attribute_p and
+ target.valid_type_attribute_p that always returns false. */
+
+int
+default_valid_attribute_p PARAMS ((attr_name, attr_args, decl, type))
+ tree attr_name ATTRIBUTE_UNUSED;
+ tree attr_args ATTRIBUTE_UNUSED;
+ tree decl ATTRIBUTE_UNUSED;
+ tree type ATTRIBUTE_UNUSED;
+{
+ return 0;
+}
+
/* 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. */
tree decl;
tree type;
{
+ tree type_attrs;
+
if (TREE_CODE (attr_name) != IDENTIFIER_NODE)
abort ();
- if (decl && target.valid_decl_attribute != NULL)
+ if (decl)
{
tree decl_attrs = DECL_MACHINE_ATTRIBUTES (decl);
}
}
- if (target.valid_type_attribute != NULL)
+ type_attrs = TYPE_ATTRIBUTES (type);
+ if ((*target.valid_type_attribute) (type, type_attrs, attr_name,
+ attr_args))
{
- tree type_attrs = TYPE_ATTRIBUTES (type);
+ tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
+ type_attrs);
- if ((*target.valid_type_attribute) (type, type_attrs, attr_name,
- attr_args))
+ if (attr != NULL_TREE)
{
- tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
- type_attrs);
-
- if (attr != NULL_TREE)
- {
- /* Override existing arguments. ??? This currently
- works since attribute arguments are not included in
- `attribute_hash_list'. Something more complicated
- may be needed in the future. */
- TREE_VALUE (attr) = attr_args;
- }
+ /* Override existing arguments. ??? This currently
+ works since attribute arguments are not included in
+ `attribute_hash_list'. Something more complicated
+ may be needed in the future. */
+ TREE_VALUE (attr) = attr_args;
+ }
+ else
+ {
+ /* If this is part of a declaration, create a type variant,
+ otherwise, this is part of a type definition, so add it
+ to the base type. */
+ type_attrs = tree_cons (attr_name, attr_args, type_attrs);
+ if (decl != 0)
+ type = build_type_attribute_variant (type, type_attrs);
else
- {
- /* If this is part of a declaration, create a type variant,
- otherwise, this is part of a type definition, so add it
- to the base type. */
- type_attrs = tree_cons (attr_name, attr_args, type_attrs);
- if (decl != 0)
- type = build_type_attribute_variant (type, type_attrs);
- else
- TYPE_ATTRIBUTES (type) = type_attrs;
- }
-
- if (decl)
- TREE_TYPE (decl) = type;
-
- return 1;
+ TYPE_ATTRIBUTES (type) = type_attrs;
}
- /* Handle putting a type attribute on pointer-to-function-type
- by putting the attribute on the function type. */
- else if (POINTER_TYPE_P (type)
- && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
- && (*target.valid_type_attribute) (TREE_TYPE (type), type_attrs,
- attr_name, attr_args))
- {
- tree inner_type = TREE_TYPE (type);
- tree inner_attrs = TYPE_ATTRIBUTES (inner_type);
- tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
- type_attrs);
+ if (decl)
+ TREE_TYPE (decl) = type;
- if (attr != NULL_TREE)
- TREE_VALUE (attr) = attr_args;
- else
- {
- inner_attrs = tree_cons (attr_name, attr_args, inner_attrs);
- inner_type = build_type_attribute_variant (inner_type,
- inner_attrs);
- }
+ return 1;
+ }
+ /* Handle putting a type attribute on pointer-to-function-type
+ by putting the attribute on the function type. */
+ else if (POINTER_TYPE_P (type)
+ && TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE
+ && (*target.valid_type_attribute) (TREE_TYPE (type), type_attrs,
+ attr_name, attr_args))
+ {
+ tree inner_type = TREE_TYPE (type);
+ tree inner_attrs = TYPE_ATTRIBUTES (inner_type);
+ tree attr = lookup_attribute (IDENTIFIER_POINTER (attr_name),
+ type_attrs);
- if (decl)
- TREE_TYPE (decl) = build_pointer_type (inner_type);
- else
- {
- /* Clear TYPE_POINTER_TO for the old inner type, since
- `type' won't be pointing to it anymore. */
- TYPE_POINTER_TO (TREE_TYPE (type)) = NULL_TREE;
- TREE_TYPE (type) = inner_type;
- }
+ if (attr != NULL_TREE)
+ TREE_VALUE (attr) = attr_args;
+ else
+ {
+ inner_attrs = tree_cons (attr_name, attr_args, inner_attrs);
+ inner_type = build_type_attribute_variant (inner_type,
+ inner_attrs);
+ }
- return 1;
+ if (decl)
+ TREE_TYPE (decl) = build_pointer_type (inner_type);
+ else
+ {
+ /* Clear TYPE_POINTER_TO for the old inner type, since
+ `type' won't be pointing to it anymore. */
+ TYPE_POINTER_TO (TREE_TYPE (type)) = NULL_TREE;
+ TREE_TYPE (type) = inner_type;
}
+
+ return 1;
}
return 0;
extern tree build_type_attribute_variant PARAMS ((tree, tree));
extern tree build_decl_attribute_variant PARAMS ((tree, tree));
+/* Default versions of target-overridable functions. */
+
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));
/* Split a list of declspecs and attributes into two. */