diff options
author | Neil Booth <neil@cat.daikokuya.demon.co.uk> | 2001-06-27 06:55:29 +0000 |
---|---|---|
committer | Neil Booth <neil@gcc.gnu.org> | 2001-06-27 06:55:29 +0000 |
commit | 501990bbfca586dd26a941f65fce7b7a5a9440ae (patch) | |
tree | 9362672ad53c9697b55642ba54ba293d0e394ede /gcc | |
parent | 84690a975d2dc7a0172c3686eb43e6ea2047b969 (diff) | |
download | gcc-501990bbfca586dd26a941f65fce7b7a5a9440ae.zip gcc-501990bbfca586dd26a941f65fce7b7a5a9440ae.tar.gz gcc-501990bbfca586dd26a941f65fce7b7a5a9440ae.tar.bz2 |
system.h (TARGET_ESC): Move to ...
* 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
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 12 | ||||
-rw-r--r-- | gcc/cp/ChangeLog | 4 | ||||
-rw-r--r-- | gcc/cp/decl2.c | 21 | ||||
-rw-r--r-- | gcc/defaults.h | 1 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 48 | ||||
-rw-r--r-- | gcc/system.h | 5 | ||||
-rw-r--r-- | gcc/tree.c | 130 | ||||
-rw-r--r-- | gcc/tree.h | 3 |
8 files changed, 150 insertions, 74 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9181638..2d087cd 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,15 @@ +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 diff --git a/gcc/cp/ChangeLog b/gcc/cp/ChangeLog index 33688d4..4e1abda 100644 --- a/gcc/cp/ChangeLog +++ b/gcc/cp/ChangeLog @@ -1,3 +1,7 @@ +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. diff --git a/gcc/cp/decl2.c b/gcc/cp/decl2.c index 7d0ee46..802ad49 100644 --- a/gcc/cp/decl2.c +++ b/gcc/cp/decl2.c @@ -2456,15 +2456,18 @@ import_export_class (ctype) 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. */ diff --git a/gcc/defaults.h b/gcc/defaults.h index 75c4225..c22f9cd 100644 --- a/gcc/defaults.h +++ b/gcc/defaults.h @@ -32,6 +32,7 @@ Boston, MA 02111-1307, USA. */ # 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 diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index 24ca6b9..e60a4eb 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -12,6 +12,19 @@ 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 @@ -23,6 +36,7 @@ containing pointers to functions and data relating to the target 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. @@ -1581,6 +1595,12 @@ explicitly define all of the macros below. 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 @@ -8300,6 +8320,33 @@ If defined, a C statement that assigns default attributes to 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 @@ -8326,6 +8373,7 @@ called @code{merge_dllimport_decl_attributes} which can then be defined 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 diff --git a/gcc/system.h b/gcc/system.h index be9c81b..295c287 100644 --- a/gcc/system.h +++ b/gcc/system.h @@ -84,11 +84,6 @@ extern int fputs_unlocked PARAMS ((const char *, FILE *)); 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> @@ -2707,6 +2707,19 @@ build_type_attribute_variant (ttype, attribute) 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. */ @@ -2718,10 +2731,12 @@ valid_machine_attribute (attr_name, attr_args, decl, type) 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); @@ -2748,75 +2763,70 @@ valid_machine_attribute (attr_name, attr_args, decl, type) } } - 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; @@ -2039,8 +2039,11 @@ extern tree make_tree PARAMS ((tree, struct rtx_def *)); 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. */ |