Changeset 598
- Timestamp:
- Aug 15, 2003, 11:11:55 PM (22 years ago)
- Location:
- trunk/src/gcc/gcc
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/src/gcc/gcc/config/i386/emx.c ¶
-
Property cvs2svn:cvs-rev
changed from
1.12
to1.13
r597 r598 30 30 #include "toplev.h" 31 31 #include "flags.h" 32 33 #define BIRD_DEBUG 32 34 33 35 /* The size of the target's pointer type. */ … … 66 68 void dump (tree node) 67 69 { 68 tree type, type2, context;70 tree type, type2, context, name; 69 71 if (!node) 70 72 return; … … 73 75 type2 = type ? TREE_TYPE(type) : NULL; 74 76 context = DECL_P (node) ? DECL_CONTEXT (node) : NULL_TREE; 75 fprintf(stderr, "dbg: node=%d %s type=%d %s type_type=%d %s context=%d %s\n", 77 name = DECL_P (node) ? DECL_NAME (node) : NULL_TREE; 78 fprintf(stderr, "dbg: node=%d %s type=%d %s type_type=%d %s context=%d %s name=%s\n", 76 79 TREE_CODE(node), code(node), 77 80 type ? TREE_CODE(type) : -1, code(type), 78 81 type2 ? TREE_CODE(type2) : -1, code(type2), 79 context ? TREE_CODE(context) : -1, code(context)); 82 context ? TREE_CODE(context) : -1, code(context), 83 name ? IDENTIFIER_POINTER (name) : "<none>"); 80 84 } 81 85 … … 88 92 89 93 90 tree ix86_handle_ system_attribute (tree *node, tree name, tree args,94 tree ix86_handle_vacpp_attribute (tree *node, tree name, tree args, 91 95 int flags, bool *no_add_attrs) 92 96 { 93 tree type; 94 (void)args; (void)flags; 95 96 dfprintf ((stderr, "dbg: %s flags=%x\n", __FUNCTION__, flags)); 97 DUMP (*node); 98 99 type = TREE_TYPE (*node); 100 if (DECL_P (*node)) 101 switch (TREE_CODE (type)) 102 { 103 case FUNCTION_TYPE: 104 { 105 tree context; 106 size_t sl; 107 const char * oldsym; 108 char * newsym; 109 110 /* typedef and field may end up here. they should not get their name changed! */ 111 if (TREE_CODE (*node) == FIELD_DECL | TREE_CODE (*node) == TYPE_DECL) 112 return NULL_TREE; 113 114 /* class method (static) ends up here too, they should be get their 115 name changed. Try check if context is RECORD_TYPE and pray that 116 means it's a class... 117 @todo: verify the class detection here! CLASSTYPE_DECLARED_CLASS? */ 118 context = DECL_CONTEXT (*node); 119 DUMP ((context)); 120 if (context && ( TREE_CODE (context) == RECORD_TYPE 121 || TREE_CODE (context) == UNION_TYPE)) 122 return NULL_TREE; 123 /** @todo more decl code checks? */ 124 125 126 /* _System mangling! 127 Specifying '*' as first symbol character tells gcc (see varasm.c, 97 tree id, type; 98 size_t sl; 99 const char *oldsym; 100 char *newsym; 101 102 DUMP (*node); 103 104 switch (TREE_CODE (*node)) 105 { 106 case FUNCTION_DECL: 107 /* This is the core of attribute handling. Every other code is 108 designed so that we end up with a function declaration and 109 an attached attribute (either optlink or system). */ 110 if (!strcmp (IDENTIFIER_POINTER (name), "system")) 111 { 112 /* Here we mangle _System functions as defined by IBM specs. 113 The function always gets its name as-is (unless it is a method, 114 which is a undefined case as VACPP always use _Optlink for methods, 115 at least that's what I have understood from the docs). */ 116 if (TREE_CODE (TREE_TYPE (*node)) == METHOD_TYPE) 117 break; 118 119 oldsym = IDENTIFIER_POINTER (DECL_NAME (*node)); 120 /* Specifying '*' as first symbol character tells gcc (see varasm.c, 128 121 function assemble_name()) to output the label as-is rather than 129 122 invoking the ASM_OUTPUT_LABELREF macro (which prepends a underscore) */ 130 oldsym = IDENTIFIER_POINTER (DECL_NAME (*node));131 123 sl = strlen (oldsym); 132 124 newsym = xmalloc (sl + 2); … … 134 126 memcpy (newsym + 1, oldsym, sl + 1); 135 127 SET_DECL_ASSEMBLER_NAME (*node, get_identifier (newsym)); 136 dfprintf((stderr, "dbg: name change: %s -> %s\n", oldsym, newsym)); 137 return NULL_TREE; 138 } 139 case POINTER_TYPE: 140 /* Pointer-to-a-function type is allowed */ 141 if (TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE 142 && TREE_CODE (TREE_TYPE (type)) != METHOD_TYPE) 128 } 129 else if (!strcmp (IDENTIFIER_POINTER (name), "optlink")) 130 { 131 /* All function types have a name which should be mangled 132 by _Optlink specification. */ 133 id = DECL_ASSEMBLER_NAME (*node); 134 /* Remove the leading underscore. */ 135 oldsym = IDENTIFIER_POINTER (id); 136 sl = strlen (oldsym); 137 newsym = xmalloc (sl + 2); 138 newsym [0] = '*'; 139 memcpy (newsym + 1, oldsym, sl + 1); 140 XEXP (DECL_RTL (*node), 0) = gen_rtx (SYMBOL_REF, Pmode, 141 IDENTIFIER_POINTER (get_identifier (newsym))); 142 } 143 else /* Huh?! */ 144 goto warn; 145 146 /* The attribute should really be attached to our _TYPE, 147 not to the _DECL */ 148 type = TREE_TYPE (*node); 149 goto attach_attr; 150 151 case TYPE_DECL: 152 /* If this is a type declaration with our attribute, 153 we allow it only if it is a pointer-to-a-function type */ 154 type = TREE_TYPE (*node); 155 if (TREE_CODE (type) == POINTER_TYPE 156 && (TREE_CODE (TREE_TYPE (type)) == FUNCTION_TYPE 157 || TREE_CODE (TREE_TYPE (type)) == METHOD_TYPE)) 158 /* Since it is just a type it doesn't have any label to mangle, 159 but if we attach the attribute to the type all calls through 160 this pointer will get arguments passed correctly */ 161 { 162 /* Attach the attribute to the (FUNCTION|METHOD)_TYPE node */ 163 type = TREE_TYPE (type); 164 attach_attr:TYPE_ATTRIBUTES (type) = chainon (TYPE_ATTRIBUTES (type), 165 tree_cons (name, args, NULL_TREE)); 166 *no_add_attrs = true; 143 167 break; 144 case METHOD_TYPE: 145 case FIELD_DECL: 146 case TYPE_DECL: 147 /* Not a error but no action either */ 148 return NULL_TREE; 149 default: 150 break; 151 } 152 else if (TREE_CODE (*node) == POINTER_TYPE && type) 153 { /* Pointer-to-a-function type is allowed */ 154 switch (TREE_CODE (type)) 155 { 156 case FUNCTION_TYPE: 157 case METHOD_TYPE: 158 return NULL_TREE; 159 default: 160 break; 161 } 162 } 163 /* potential warnings get here */ 164 165 /* IF there is a function in the works, we don't complain and 166 make sure _System is tried again on the function declaration. 167 OR if this is a function type we need to pass it up to the 168 declaration which is likely to be a some kind of type or field. 169 */ 170 if ( (flags & (int)ATTR_FLAG_FUNCTION_NEXT) 171 || TREE_CODE (*node) == FUNCTION_TYPE 172 || TREE_CODE (*node) == METHOD_TYPE) 173 return tree_cons (name, args, NULL_TREE); 174 175 warning ("`%s' attribute only applies to functions and function types", 176 IDENTIFIER_POINTER (name)); 177 *no_add_attrs = true; 178 179 return NULL_TREE; 180 } 181 182 183 tree ix86_handle_optlink_attribute (tree *node, tree name, tree args, 184 int flags, bool *no_add_attrs) 185 { 186 tree id, type, typeset; 187 size_t sl; 188 const char *oldsym; 189 char *newsym; 190 191 (void)args; (void)flags; 192 193 typeset = NULL; 194 type = TREE_TYPE (*node); 195 if (DECL_P (*node)) 196 switch (TREE_CODE (type)) 197 { 198 case FUNCTION_TYPE: 199 case METHOD_TYPE: 200 typeset = type; 201 case FIELD_DECL: /* how come these needs mangling? */ 202 case TYPE_DECL: 203 id = DECL_ASSEMBLER_NAME (*node); 204 /* Remove the leading underscore */ 205 oldsym = IDENTIFIER_POINTER (id); 206 sl = strlen (oldsym); 207 newsym = xmalloc (sl + 2); 208 newsym [0] = '*'; 209 memcpy (newsym + 1, oldsym, sl + 1); 210 XEXP (DECL_RTL (*node), 0) = gen_rtx (SYMBOL_REF, Pmode, 211 IDENTIFIER_POINTER (get_identifier (newsym))); 212 break; 213 case POINTER_TYPE: 214 /* Pointer-to-a-function type is allowed */ 215 if (TREE_CODE (TREE_TYPE (type)) != FUNCTION_TYPE 216 && TREE_CODE (TREE_TYPE (type)) != METHOD_TYPE) 217 goto warn; 218 /*@@@@@todo: not finished*/ 219 typeset = type; 220 break; 221 default: 222 goto warn; 223 } 224 else if (TREE_CODE (*node) == POINTER_TYPE && type) 225 { /* Pointer-to-a-function type is allowed */ 226 switch (TREE_CODE (type)) 227 { 228 case FUNCTION_TYPE: 229 case METHOD_TYPE: 230 typeset = type; 231 break; 232 default: 233 goto warn; 234 } 235 } 236 else 237 { 238 warn: warning ("`%s' attribute only applies to functions and function types", 239 IDENTIFIER_POINTER (name)); 240 *no_add_attrs = true; 241 DUMP (*node); 242 } 243 244 /* attach attribute to type. */ 245 if (typeset) 246 { 247 id = tree_cons (name, args, NULL_TREE); 248 TYPE_ATTRIBUTES (typeset) = chainon (TYPE_ATTRIBUTES (typeset), id); 249 return id; 168 } 169 goto warn; 170 171 case POINTER_TYPE: 172 if (flags & ATTR_FLAG_FUNCTION_NEXT) 173 { 174 /* This is the return type for a function. Ignore attribute 175 for the return type itself and re-apply it later to the 176 function itself. */ 177 defer_attr: *no_add_attrs = true; 178 return tree_cons (name, args, NULL_TREE); 179 } 180 else if (flags & ATTR_FLAG_DECL_NEXT) 181 { 182 /* The node passed is the type of a DECL that will follow. 183 If the decl is a function or a method, tell decl_attributes() 184 that the attribute should be applied to the decl rather than 185 to its return type */ 186 type = TREE_TYPE (*node); 187 if (type 188 && (TREE_CODE (type) == FUNCTION_TYPE 189 || TREE_CODE (type) == METHOD_TYPE)) 190 goto defer_attr; 191 } 192 goto warn; 193 194 default: 195 warn: warning ("`%s' attribute only applies to functions and function types", 196 IDENTIFIER_POINTER (name)); 197 *no_add_attrs = true; 198 DUMP (*node); 199 break; 250 200 } 251 201 … … 277 227 strcpy (lbl, "__POST$"); 278 228 if (func_label[0] == '*') 279 229 func_label++; 280 230 strcat (lbl, func_label); 281 231 ASM_OUTPUT_LABEL (f, lbl); -
Property cvs2svn:cvs-rev
changed from
-
TabularUnified trunk/src/gcc/gcc/config/i386/emx.h ¶
-
Property cvs2svn:cvs-rev
changed from
1.14
to1.15
r597 r598 91 91 #define DWARF2_UNWIND_INFO 1 92 92 93 /* This function handles both _System and _Optlink attributes */ 94 extern tree ix86_handle_vacpp_attribute PARAMS ((tree *, tree, tree, int, _Bool *)); 95 93 96 /* We want the _System attribute */ 94 97 #define TARGET_SYSTEM_DECL_ATTRIBUTES 95 /* Handle _System attribute */ 96 extern tree ix86_handle_system_attribute PARAMS ((tree *, tree, tree, int, _Bool *)); 98 #define ix86_handle_system_attribute ix86_handle_vacpp_attribute 97 99 98 100 /* We want the _Optlink attribute */ 99 101 #define TARGET_OPTLINK_DECL_ATTRIBUTES 100 /* Handle _Optlink attribute */ 101 extern tree ix86_handle_optlink_attribute PARAMS ((tree *, tree, tree, int, _Bool *)); 102 #define ix86_handle_optlink_attribute ix86_handle_vacpp_attribute 102 103 103 104 /* This macros will stick a label to exception table for current file, -
Property cvs2svn:cvs-rev
changed from
-
TabularUnified trunk/src/gcc/gcc/cp/decl.c ¶
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r597 r598 13638 13638 else 13639 13639 { 13640 decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, NULL);13640 decl1 = grokdeclarator (declarator, declspecs, FUNCDEF, 1, &attrs); 13641 13641 /* If the declarator is not suitable for a function definition, 13642 13642 cause a syntax error. */ -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.