Changeset 615
- Timestamp:
- Aug 16, 2003, 9:31:23 PM (22 years ago)
- Location:
- trunk/src/gcc/gcc/config/i386
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/gcc/gcc/config/i386/emx.c
-
Property cvs2svn:cvs-rev
changed from
1.16
to1.17
r614 r615 95 95 #endif 96 96 97 98 97 tree ix86_handle_vacpp_attribute (tree *node, tree name, tree args, 99 98 int flags, bool *no_add_attrs) … … 113 112 an attached attribute (either optlink or system). 114 113 This is the only part which is changing the mangling. */ 114 115 type = TREE_TYPE (*node); 116 117 if (ix86_check_append_attr (type, name, no_add_attrs)) 118 break; 119 115 120 if (is_attribute_p ("system", name)) 116 121 { … … 122 127 CLASSTYPE_DECLARED_CLASS (meaning it doesn't apply to plain 123 128 structs/unions) ? */ 124 if ( TREE_CODE ( TREE_TYPE (*node)) != METHOD_TYPE129 if ( TREE_CODE (type) != METHOD_TYPE 125 130 && ( !(context = DECL_CONTEXT (*node)) 126 131 || ( TREE_CODE (context) != RECORD_TYPE … … 171 176 /* The attribute should really be attached to our _TYPE 172 177 rather than to the _DECL. */ 173 type = TREE_TYPE (*node);174 178 TYPE_ATTRIBUTES (type) = chainon (TYPE_ATTRIBUTES (type), 175 179 tree_cons (name, args, NULL_TREE)); … … 192 196 || TREE_CODE (type) == METHOD_TYPE) 193 197 { 198 if (ix86_check_append_attr (type, name, no_add_attrs)) 199 break; 200 194 201 /* Attach the attribute to the (FUNCTION|METHOD)_TYPE node */ 195 202 TYPE_ATTRIBUTES (type) = chainon (TYPE_ATTRIBUTES (type), … … 198 205 break; 199 206 } 200 warning ("`%s' attribute only applies to functions and function types (typecode=%d)",201 IDENTIFIER_POINTER (name) , type ? (int)TREE_CODE (type) : -1);207 warning ("`%s' attribute only applies to functions and function types", 208 IDENTIFIER_POINTER (name)); 202 209 *no_add_attrs = true; 203 210 break; -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/i386-protos.h
-
Property cvs2svn:cvs-rev
changed from
1.1
to1.2
r614 r615 183 183 184 184 #ifdef TREE_CODE 185 extern int ix86_check_append_attr PARAMS ((tree, tree, bool *)); 186 185 187 extern int ix86_return_pops_args PARAMS ((tree, tree, int)); 186 188 extern tree ix86_build_va_list PARAMS ((void)); -
Property cvs2svn:cvs-rev
changed from
-
trunk/src/gcc/gcc/config/i386/i386.c
-
Property cvs2svn:cvs-rev
changed from
1.6
to1.7
r614 r615 1296 1296 }; 1297 1297 1298 /* Check if we don't have incompatible calling conversion attributes */ 1299 int 1300 ix86_check_append_attr (tree type, tree name, bool *no_add_attrs) 1301 { 1302 /* ??? use ix86_comp_type_attributes maybe ??? */ 1303 unsigned i; 1304 const char *exclname; 1305 static const char *cc [] = 1306 { 1307 "cdecl", 1308 "stdcall", 1309 "regparm", 1310 #ifdef TARGET_SYSTEM_DECL_ATTRIBUTES 1311 "system", 1312 #endif 1313 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1314 "optlink", 1315 #endif 1316 }; 1317 1318 exclname = IDENTIFIER_POINTER (name); 1319 if (exclname [0] == '_') 1320 { 1321 /* Remove leading and trailing underscores */ 1322 const char *x1, *x2; 1323 char *newname; 1324 x1 = exclname + 1; 1325 while (*x1 == '_') 1326 x1++; 1327 x2 = strchr (x1, 0); 1328 while (x2 [-1] == '_' && x2 > x1) 1329 x2--; 1330 newname = alloca (x2 - x1 + 1); 1331 memcpy (newname, x1, x2 - x1); 1332 newname [x2 - x1] = 0; 1333 exclname = newname; 1334 } 1335 1336 for (i = 0; i < sizeof (cc) / sizeof (const char *); i++) 1337 if (lookup_attribute (cc [i], TYPE_ATTRIBUTES (type))) 1338 { 1339 /* Warn if we have another calling convention attribute and it is 1340 different from the currently processed attribute. If there is 1341 already an attribute with the same name attached, silently ignore 1342 currently processed attribute. */ 1343 if (strcmp (exclname, cc [i])) 1344 warning ("`%s' attribute is incompatible with earlier defined `%s' attribute", 1345 IDENTIFIER_POINTER (name), cc [i]); 1346 *no_add_attrs = true; 1347 return -1; 1348 } 1349 1350 return 0; 1351 } 1352 1298 1353 /* Handle a "cdecl" or "stdcall" attribute; 1299 1354 arguments as in struct attribute_spec.handler. */ … … 1322 1377 } 1323 1378 1379 /* Check if the attributes are compatible */ 1380 if (ix86_check_append_attr (*node, name, no_add_attrs)) 1381 return NULL_TREE; 1382 1324 1383 return NULL_TREE; 1325 1384 } … … 1363 1422 } 1364 1423 1424 /* Check if the attributes are compatible */ 1425 if (ix86_check_append_attr (*node, name, no_add_attrs)) 1426 return NULL_TREE; 1427 1365 1428 return NULL_TREE; 1366 1429 } … … 1474 1537 tree type2; 1475 1538 { 1476 /* Check for mismatch of non-default calling convention. */ 1477 const char *const rtdstr = TARGET_RTD ? "cdecl" : "stdcall"; 1478 1479 /* 1480 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ TODO: check for optlink and system 1481 #ifdef SUBTARGET_COMP_TYPE_ATTRIBUTES 1482 SUBTARGET_COMP_TYPE_ATTRIBUTES 1539 unsigned i; 1540 unsigned char cc1 = 0, cc2 = 0; 1541 static struct 1542 { 1543 const char *attr; 1544 unsigned char flag; 1545 } typecode [] = 1546 { 1547 { "cdecl", 0x10 }, 1548 { "stdcall", 0x20 }, 1549 { "regparm", 0x30 }, 1550 #ifdef TARGET_SYSTEM_DECL_ATTRIBUTES 1551 { "system", 0x11 }, 1483 1552 #endif 1484 */ 1485 1553 #ifdef TARGET_OPTLINK_DECL_ATTRIBUTES 1554 { "optlink", 0x40 }, 1555 #endif 1556 }; 1557 1558 /* The following calling conventions have meaning only for functions */ 1486 1559 if (TREE_CODE (type1) != FUNCTION_TYPE) 1487 1560 return 1; 1488 1561 1489 /* Check for mismatched return types (cdecl vs stdcall). */ 1490 if (!lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type1)) 1491 != !lookup_attribute (rtdstr, TYPE_ATTRIBUTES (type2))) 1562 /* The function may have only one calling convention. 1563 * For simplicity we translate the calling conversion attribute 1564 * to a numeric constant, then the numbers are compared. 1565 * 1566 * If the top 4 bits are the same, the types are compatible 1567 * (e.g. issue a warning but allow the operation). 1568 */ 1569 1570 for (i = 0; i < sizeof (typecode) / sizeof (typecode [0]); i++) 1571 { 1572 if (lookup_attribute (typecode [i].attr, TYPE_ATTRIBUTES (type1))) 1573 cc1 = typecode [i].flag; 1574 if (lookup_attribute (typecode [i].attr, TYPE_ATTRIBUTES (type2))) 1575 cc2 = typecode [i].flag; 1576 } 1577 1578 if (!cc1) 1579 cc1 = TARGET_RTD ? 0x20 : 0x10; 1580 if (!cc2) 1581 cc2 = TARGET_RTD ? 0x20 : 0x10; 1582 1583 /* If calling conventions are the same, its okay */ 1584 if (cc1 == cc2) 1585 return 1; 1586 1587 /* If they are not compatible, return 0 */ 1588 if ((cc1 ^ cc2) & 0xf0) 1492 1589 return 0; 1493 return 1; 1590 1591 /* They are nearly compatible, issue a warning */ 1592 return 2; 1494 1593 } 1495 1594 -
Property cvs2svn:cvs-rev
changed from
Note:
See TracChangeset
for help on using the changeset viewer.