Changeset 291 for trunk/src


Ignore:
Timestamp:
Jun 4, 2003, 5:00:38 AM (22 years ago)
Author:
bird
Message:

#456: Fixed globals.
#456: Made it understand nested 'long long' @s typedefs.
#456: Worked around crash when show_type() on FILE.
#456: Complex types quick implementation. TODO: make structs.

File:
1 edited

Legend:

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

    • Property cvs2svn:cvs-rev changed from 1.3 to 1.4
    r290 r291  
    342342static int unnamed_struct_number;
    343343
     344#ifndef HLL_DEBUG
    344345/* Suppress several kinds of warnings since newer gccs generates lots of
    345346   warnings... */
     
    349350  (void)format;
    350351}
     352#else
     353#define no_warning warning
     354#endif
    351355
    352356
     
    590594        case ty_array:
    591595          if (p->d.array.etype == src->d.array.etype
    592               && p->d.array.itype == src->d.array.itype           
     596              && p->d.array.itype == src->d.array.itype
    593597              && p->d.array.first == src->d.array.first
    594598              && p->d.array.last == src->d.array.last)
     
    779783{
    780784  int i;
     785
     786  /* Currently we crash when showing FILE (stdio.h). So, better not crash here..  */
     787  if (!tp)
     788    {
     789    printf("!!! error! NULL type pointer! !!!");
     790    return;
     791    }
    781792
    782793  switch (tp->tag)
     
    13751386      break;
    13761387
     1388    case 'R':
     1389
     1390      /* Complex number: R<?base_type?>;<size bytes>;<0>; */
     1391
     1392      ++parse_ptr;
     1393      if (!parse_number (&num1) || !parse_char (';')
     1394          || !parse_number (&width) || !parse_char (';')
     1395          || !parse_number (&code) || !parse_char (';'))
     1396        goto syntax;
     1397
     1398      /*
     1399       * The 192bit type is not defined in the HLL specs, but we assume it for
     1400       * convenince right now.
     1401       *
     1402       * It seems like no debugger acutally supports these types. So, we should,
     1403       * when somebody requires it for debugging complex math, make structs out
     1404       * of these declarations like GCC does for the 'complex int' type.
     1405       *
     1406       * .stabs "FakeComplexInt:t21=22=s8real:1,0,32;imag:1,32,32;;",128,0,0,0
     1407       * .stabs "FakeComplexFloat:t23=24=s8real:12,0,32;imag:12,32,32;;",128,0,0,0
     1408       * .stabs "FakeComplexDouble:t25=26=s16real:13,0,64;imag:13,64,64;;",128,0,0,0
     1409       * .stabs "FakeComplexLongDouble:t27=28=s24real:14,0,96;imag:14,96,96;;",128,0,0,0
     1410       *
     1411       */
     1412      t.tag = ty_prim;
     1413      if (width == 8 && code == 0)
     1414        t.index = 0x8c;
     1415      else if (width == 16 && code == 0)
     1416        t.index = 0x8d ;
     1417      else if (width == 20 && code == 0)
     1418        t.index = 0x8e;
     1419      else if (width == 24 && code == 0)
     1420        t.index = 0x8f; //TODO: bogus!!!
     1421      else
     1422        {
     1423          no_warning ("Unknown complex type: %ld/%ld", width, code);
     1424          goto syntax;
     1425        }
     1426      break;
     1427
    13771428    case '*':
    13781429
     
    14471498                        -20              char
    14481499
     1500         @s<bits>;<range record>
     1501            Used for 64 bit ints.
    14491502
    14501503      */
     
    14571510          if (!parse_number (&size) || !parse_char (';'))
    14581511            goto syntax;
     1512          if (*parse_ptr == 'r')
     1513            { /* nested */
     1514              return parse_type(type_name);
     1515            }
     1516
    14591517          if (!parse_number (&code))
    14601518            goto syntax;
     
    19992057
    20002058syntax:
     2059  no_warning ("syntax error in stabs: %c", *parse_ptr);
    20012060  grow_free (&g1);
    20022061  t.tag = ty_prim;
     
    27222781        {
    27232782        case 'G':
    2724 
     2783          {
     2784          char *psz;
     2785          int   cch;
    27252786          /* Static storage, global scope */
    27262787
     
    27302791          printf ("  type=%#x\n", ti);
    27312792#endif
    2732           sym2 = find_symbol (name);
     2793
     2794          psz = alloca(cch = strlen(name) + 2);
     2795          *psz = '_';
     2796          strcpy(psz+1, name);
     2797          sym2 = find_symbol (psz);
    27332798          if (sym2 == NULL)
    27342799            {
    2735               no_warning ("Cannot find address of global variable %s", name);
     2800              no_warning ("Cannot find address of global variable %s (%s)", name, psz);
    27362801              return;
    27372802            }
     
    27412806            sst_static (name, sym2->n_value, ti, sym2->n_type, 0);
    27422807          break;
     2808          }
    27432809
    27442810        case 'S':
Note: See TracChangeset for help on using the changeset viewer.