Changeset 319 for trunk/src


Ignore:
Timestamp:
Jun 11, 2003, 7:11:16 PM (23 years ago)
Author:
bird
Message:

#456: Size of complex HLL prims.
#456: Improved some errors and warnings, and enabled all warnings again.---
#456: Made use of internal typedef ty_alias. This is used for internal representation of const and volatile types.
#456: Understand 'B' stab types (volatile).
#456: Fixed parsing of template names with embedded '::'.
#456: Enums requires symbol scope table tags too.
#456: Treat ' ' (space) struct/union/enum tag names as empty and generate a name for them. This works best.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/emx/src/emxomf/stabshll.c

    • Property cvs2svn:cvs-rev changed from 1.7 to 1.8
    r318 r319  
    264264static const char *parse_ptr;
    265265
     266
     267
     268
     269
    266270/* The next HLL type index.  When creating a complex type, this index
    267271   is used.  Then, this variable is incremented. */
     
    345349static int unnamed_struct_number;
    346350
    347 #ifndef HLL_DEBUG
    348 /* Suppress several kinds of warnings since newer gccs generates lots of
    349    warnings... */
    350 
    351 static void no_warning (char *format, ...)
    352 {
    353   (void)format;
    354 }
    355 #else
     351/* kso #456 2003-06-11: Reversed quiet workaround. */
    356352#define no_warning warning
    357 #endif
    358353
    359354
     
    555550  int i;
    556551
    557   if (src->tag == ty_alias)
    558     abort ();
    559552  for (p = type_head; p != NULL; p = p->next)
    560553    if (p->tag == src->tag)
    561554      switch (p->tag)
    562555        {
     556
     557
     558
     559
    563560        case ty_stabs_ref:
    564561          if (p->d.stabs_ref == src->d.stabs_ref)
     
    610607        case ty_func:
    611608          if (p->d.func.ret == src->d.func.ret
    612               && p->d.func.args == src->d.func.args)
     609              && p->d.func.args == src->d.func.args
     610              && p->d.func.domain == src->d.func.domain
     611              && p->d.func.arg_count == src->d.func.arg_count)
    613612            return p;
    614613          break;
     
    740739#ifdef HLL_DEBUG
    741740  printf ("  type: stabs %d => HLL 0x%x\n", number, hll->index);
     741
    742742  if (stype_list[number-1] != NULL && stype_list[number-1] != hll)
    743743    warning ("Type stabs %d allready mapped to HLL 0x%x, new HLL 0x%x!!\n", number, stype_list[number-1]->index, hll->index);
    744 #endif
    745744
    746745  stype_list[number-1] = hll;
     
    941940          return 4;
    942941        case 0x89:              /* 64 bit real */
     942
    943943          return 8;
    944944        case 0x8a:              /* 80 bit real (96 bits of storage) */
    945945          return 12;
     946
     947
     948
     949
     950
     951
    946952        }
    947953      error ("type_size: Unknown primitive type: %d", tp->index);
     
    12141220  if (*parse_ptr != c)
    12151221    {
    1216       no_warning ("Invalid symbol data: `%c' expected", c);
     1222      no_warning ("Invalid symbol data: `%c' expected, found '%c' (off %ld)\n stabs: %s",
     1223                  c, *parse_ptr, parse_ptr - parse_start, parse_start);
    12171224      return FALSE;
    12181225    }
     
    12781285  char tmp[32];
    12791286
     1287
     1288
     1289
     1290
     1291
     1292
     1293
     1294
     1295
     1296
     1297
    12801298  if (type_name == NULL)
    12811299    {
     
    12841302    }
    12851303  return strpool_add (str_pool, type_name);
     1304
     1305
     1306
     1307
     1308
     1309
     1310
     1311
     1312
     1313
     1314
     1315
     1316
     1317
     1318
     1319
     1320
     1321
     1322
     1323
     1324
     1325
     1326
     1327
     1328
     1329
     1330
     1331
     1332
     1333
     1334
     1335
     1336
    12861337}
    12871338
     
    14571508    case 'k':
    14581509
    1459       /* A const type: k<type> */
     1510      /* A const type: k<type>
     1511         HLL don't have const typedefs afaik, so we just make it an alias. */
    14601512
    14611513      ++parse_ptr;
    1462       if (!parse_number (&num1))
    1463           goto syntax;
    1464 
    1465       result = stype_find (num1);
    1466       if (result == NULL)
    1467         {
    1468           t.tag = ty_stabs_ref;
    1469           t.d.stabs_ref = num1;
    1470         }
    1471       break;
     1514      t1 = parse_type (NULL);
     1515      t.tag = ty_alias;
     1516      t.d.alias = t1;
     1517      break;
     1518
     1519   case 'B':
     1520
     1521      /* A volatile type: B<type>
     1522         This is a SUN extension, and right now we don't care to generate
     1523         specific HLL for it and stick with an alias. */
     1524
     1525      ++parse_ptr;
     1526      t1 = parse_type (NULL);
     1527      t.tag = ty_alias;
     1528      t.d.alias = t1;
     1529      break;
     1530
    14721531
    14731532    case '&':
     
    15001559          if (!parse_char (';'))
    15011560            goto syntax;
     1561
    15021562        }
    15031563      else
     
    15191579
    15201580      t3 = NULL;
    1521       #if 0
     1581      #if 0
    15221582      if (args_grow.count)
    15231583        {
     
    16141674        }
    16151675      ++parse_ptr;
    1616       p1 = strchr (parse_ptr, ':');
     1676      p1 = );
    16171677      if (p1 == NULL)
    16181678        {
     
    17051765                  break;
    17061766                case ty_struc:
    1707                   struct_to_class (t1);
     1767                  /* kso #456 2003-06-11: Don't mess with forward defines! */
     1768                  if (!(   (t1->d.struc.flags & STRUC_FORWARD)
     1769                        && t1->d.struc.types == NULL
     1770                        && t1->d.struc.fields == NULL))
     1771                    struct_to_class (t1);
    17081772                  break;
    17091773                default:
     
    17181782      while (*parse_ptr != ';')
    17191783        {
    1720           p1 = strchr (parse_ptr, ':');
     1784          p1 = );
    17211785          if (p1 == NULL)
    17221786            {
     
    20242088      while (*parse_ptr != ';')
    20252089        {
    2026           p1 = strchr (parse_ptr, ':');
     2090          p1 = );
    20272091          if (p1 == NULL)
    20282092            {
     
    21182182      t.tag = ty_func;
    21192183      t.d.func.ret = t1;
     2184
    21202185      t.d.func.args = NULL;
    21212186      t.d.func.arg_count = 0;
     
    21342199
    21352200syntax:
    2136   no_warning ("syntax error in stabs: %c", *parse_ptr);
     2201  no_warning ("syntax error in stabs: %c (off %ld)\n stabs: %s",
     2202              *parse_ptr, parse_ptr - parse_start, parse_start);
     2203
    21372204  grow_free (&g1);
    21382205  t.tag = ty_prim;
     
    21532220  tp = parse_type (type_name);
    21542221  if (*parse_ptr != 0)
    2155     no_warning ("unexpected character at end of stabs type: %c", *parse_ptr);
     2222      no_warning ("unexpected character at end of stabs type: %c (off %ld)\n stabs: %s",
     2223                  *parse_ptr, parse_ptr - parse_start, parse_start);
    21562224  return tp;
    21572225}
     
    25302598
    25312599  alloc_flag = concat_symbols (index, &str);
    2532   p = strchr (str, ':');
     2600  p = );
    25332601  if (p != NULL)
    25342602    {
     
    25402608      printf ("LSYM/LCSYM/GSYM/PSYM/RSYM/STSYM/FUN %s\n", str);
    25412609#endif
    2542       parse_ptr = p + 1;
     2610      parse_ptr = p + 1;
    25432611      switch (*parse_ptr)
    25442612        {
     
    26602728  if (s->n_type != N_FUN)
    26612729    return FALSE;
    2662   p = strchr (str_ptr + s->n_un.n_strx, ':');
     2730  p = );
    26632731  if (p == NULL)
    26642732    return FALSE;
     
    27552823
    27562824  str = str_ptr + symbol->n_un.n_strx;
    2757   p = strchr (str, ':');
     2825  p = );
    27582826  if (p == NULL)
    27592827    abort ();
     
    27742842  if (t1)
    27752843    { /* C++ member function */
     2844
     2845
     2846
    27762847      sst_start (SST_memfunc);
    27772848      r.r_address = sst.size;
    27782849      buffer_dword (&sst, symbol->n_value); /* Segment offset */
    2779       buffer_word (&sst, t1->index);        /* Type index */
     2850      buffer_word (&sst, t       /* Type index */
    27802851      proc_patch_base = sst.size;
    27812852      buffer_dword (&sst, 0);       /* Length of proc */
     
    28762947  symbol = &sym_ptr[*index];
    28772948  alloc_flag = concat_symbols (index, &str);
    2878   p = strchr (str, ':');
     2949  p = );
    28792950  if (p != NULL)
    28802951    {
     
    28862957      printf ("%s %s\n", msg, str);
    28872958#endif
    2888       parse_ptr = p + 1;
     2959      parse_ptr = p + 1;
    28892960      switch (*parse_ptr)
    28902961        {
     
    30723143          last_fun_type.tag = ty_func;
    30733144          last_fun_type.index = -1;
     3145
    30743146          last_fun_type.d.func.ret = parse_type (NULL);
    30753147
     
    31433215{
    31443216  if (name != NULL)
    3145     {
     3217    { /* kso #456 2003-06-11: Templates can make very long names.
     3218         Clip them and let the debugger burn on them if it doesn't like it. */
     3219      char  achName[256];
     3220      int   cch = strlen(name);
     3221      if (cch > 250)
     3222        {
     3223          warning ("type_tag: name is longer than 250 bytes (%d).", cch);
     3224          cch = 250;
     3225        }
     3226      memcpy (achName, name, cch);
     3227      achName[cch] = '\0';
     3228
    31463229      sst_start (type);
    31473230      buffer_word (&sst, index);
    31483231      if (type == SST_class)
    3149         buffer_enc (&sst, name);
     3232        buffer_enc (&sst, ame);
    31503233      else
    3151         buffer_nstr (&sst, name);
     3234        buffer_nstr (&sst, ame);
    31523235      sst_end ();
    31533236    }
     
    33133396          type_tag (SST_class, t1->index, t1->d.class.name);
    33143397          break;
     3398
     3399
     3400
    33153401        default:
    33163402          break;
Note: See TracChangeset for help on using the changeset viewer.