Changeset 589


Ignore:
Timestamp:
Aug 12, 2003, 2:13:57 PM (22 years ago)
Author:
bird
Message:

#572,#570: typedef void (* _Optlink PFN)(void *pvThis);

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/gcc/gcc/config/i386/emx.c

    • Property cvs2svn:cvs-rev changed from 1.9 to 1.10
    r588 r589  
    3535#define PTR_SIZE (POINTER_SIZE / BITS_PER_UNIT)
    3636#endif
     37#if 0 /* debug */
     38const char *code(tree node)
     39{
     40    if (node)
     41    {
     42        switch (TREE_CODE (node))
     43        {
     44            case FUNCTION_TYPE: return "FUNCTION_TYPE";
     45            case FUNCTION_DECL: return "FUNCTION_DECL";
     46            case METHOD_TYPE:   return "METHOD_TYPE";
     47            case FIELD_DECL:    return "FIELD_DECL";
     48            case TYPE_DECL:     return "TYPE_DECL";
     49            case POINTER_TYPE:  return "POINTER_TYPE";
     50            case VOID_TYPE:  return "VOID_TYPE";
     51            case INTEGER_TYPE:  return "INTEGER_TYPE";
     52            case CHAR_TYPE:  return "CHAR_TYPE";
     53            case SET_TYPE:  return "SET_TYPE";
     54            case ARRAY_TYPE:  return "ARRAY_TYPE";
     55            case RECORD_TYPE:  return "RECORD_TYPE";
     56            case QUAL_UNION_TYPE:  return "QUAL_UNION_TYPE";
     57            case UNION_TYPE:  return "UNION_TYPE";
     58            default:
     59                break;
     60        }
     61    }
     62    return "";
     63}
     64
     65void dump (tree node)
     66{
     67    const char *psz = "";
     68    tree        type = TREE_TYPE (node);
     69    tree        type2 = type ? TREE_TYPE(type) : NULL;
     70
     71    fprintf(stderr, "dbg: node=%d %s type=%d %s type_type=%d %s\n",
     72            TREE_CODE(node), code(node),
     73            type ? TREE_CODE(type) : -1, code(type),
     74            type2 ? TREE_CODE(type2) : -1, code(type2));
     75}
     76#endif
    3777
    3878tree ix86_handle_system_attribute (tree *node, tree name, tree args,
     
    4686  (void)args; (void)flags;
    4787
     88  type = TREE_TYPE (*node);
    4889  if (DECL_P (*node))
    49     switch (TREE_CODE (type = TREE_TYPE (*node)))
     90    switch (TREE_CODE (type))
    5091      {
    5192        case FUNCTION_TYPE:
     
    75116          goto warn;
    76117      }
     118  else if (TREE_CODE (*node) == POINTER_TYPE && type)
     119    { /* Pointer-to-a-function type is allowed */
     120      switch (TREE_CODE (type))
     121        {
     122          case FUNCTION_TYPE:
     123          case METHOD_TYPE:
     124            break;
     125          default:
     126            goto warn;
     127        }
     128    }
    77129  else
    78130    {
     
    80132               IDENTIFIER_POINTER (name));
    81133      *no_add_attrs = true;
     134      /*dump(*node); */
    82135    }
    83136
     
    88141  int flags, bool *no_add_attrs)
    89142{
    90   tree id, type;
     143  tree id, type, typeset;
    91144  size_t sl;
    92145  const char *oldsym;
     
    95148  (void)args; (void)flags;
    96149
     150  typeset = NULL;
     151  type = TREE_TYPE (*node);
    97152  if (DECL_P (*node))
    98     switch (TREE_CODE (type = TREE_TYPE (*node)))
     153    switch (TREE_CODE (type))
    99154      {
    100155        case FUNCTION_TYPE:
    101156        case METHOD_TYPE:
    102         case FIELD_DECL:
    103         case TYPE_DECL:
     157          typeset = type;
     158        case FIELD_DECL:                /* how come these needs mangling? */
     159        case TYPE_DECL:                 /* how come? */
    104160          id = DECL_ASSEMBLER_NAME (*node);
    105161          /* Remove the leading underscore */
     
    118174            goto warn;
    119175/*@@@@@todo: not finished*/
     176          typeset = type;
    120177          break;
    121178        default:
    122179          goto warn;
    123180      }
     181  else if (TREE_CODE (*node) == POINTER_TYPE && type)
     182    { /* Pointer-to-a-function type is allowed */
     183      switch (TREE_CODE (type))
     184        {
     185          case FUNCTION_TYPE:
     186          case METHOD_TYPE:
     187            typeset = type;
     188            break;
     189          default:
     190            goto warn;
     191        }
     192    }
    124193  else
    125194    {
     
    127196               IDENTIFIER_POINTER (name));
    128197      *no_add_attrs = true;
     198      /*dump(*node); */
     199    }
     200
     201  /* attach attribute to type. */
     202  if (typeset)
     203    {
     204      id = tree_cons (name, args, NULL_TREE);
     205      TYPE_ATTRIBUTES (typeset) = chainon (TYPE_ATTRIBUTES (typeset), id);
     206      return id;
    129207    }
    130208
Note: See TracChangeset for help on using the changeset viewer.