Mercurial > projects > ldc
comparison dmd/mtype.c @ 305:2b72433d5c8c trunk
[svn r326] Fixed a bunch of issues with printf's that MinGW32 did not support.
Fixed problems with label collisions when using labels inside inline asm. LabelStatement is now easily reached given its
Identifier, which should be useful elsewhere too.
Enabled inline asm for building the lib/compiler/llvmdc runtime code, fixing branches out of asm makes this possible.
author | lindquist |
---|---|
date | Fri, 27 Jun 2008 22:04:35 +0200 |
parents | 297690b5d4a5 |
children | aaade6ded589 |
comparison
equal
deleted
inserted
replaced
304:3ebc136702dd | 305:2b72433d5c8c |
---|---|
1651 sz = n2; | 1651 sz = n2; |
1652 } | 1652 } |
1653 return sz; | 1653 return sz; |
1654 | 1654 |
1655 Loverflow: | 1655 Loverflow: |
1656 error(loc, "index %jd overflow for static array", sz); | 1656 error(loc, "index %lld overflow for static array", sz); |
1657 return 1; | 1657 return 1; |
1658 } | 1658 } |
1659 | 1659 |
1660 unsigned TypeSArray::alignsize() | 1660 unsigned TypeSArray::alignsize() |
1661 { | 1661 { |
1719 uinteger_t d = dim->toUInteger(); | 1719 uinteger_t d = dim->toUInteger(); |
1720 | 1720 |
1721 sc = sc->pop(); | 1721 sc = sc->pop(); |
1722 | 1722 |
1723 if (d >= td->objects->dim) | 1723 if (d >= td->objects->dim) |
1724 { error(loc, "tuple index %ju exceeds %u", d, td->objects->dim); | 1724 { error(loc, "tuple index %llu exceeds %u", d, td->objects->dim); |
1725 goto Ldefault; | 1725 goto Ldefault; |
1726 } | 1726 } |
1727 Object *o = (Object *)td->objects->data[(size_t)d]; | 1727 Object *o = (Object *)td->objects->data[(size_t)d]; |
1728 if (o->dyncast() == DYNCAST_DSYMBOL) | 1728 if (o->dyncast() == DYNCAST_DSYMBOL) |
1729 { | 1729 { |
1773 dim = semanticLength(sc, sd, dim); | 1773 dim = semanticLength(sc, sd, dim); |
1774 dim = dim->optimize(WANTvalue | WANTinterpret); | 1774 dim = dim->optimize(WANTvalue | WANTinterpret); |
1775 uinteger_t d = dim->toUInteger(); | 1775 uinteger_t d = dim->toUInteger(); |
1776 | 1776 |
1777 if (d >= sd->objects->dim) | 1777 if (d >= sd->objects->dim) |
1778 { error(loc, "tuple index %ju exceeds %u", d, sd->objects->dim); | 1778 { error(loc, "tuple index %llu exceeds %u", d, sd->objects->dim); |
1779 return Type::terror; | 1779 return Type::terror; |
1780 } | 1780 } |
1781 Object *o = (Object *)sd->objects->data[(size_t)d]; | 1781 Object *o = (Object *)sd->objects->data[(size_t)d]; |
1782 if (o->dyncast() != DYNCAST_TYPE) | 1782 if (o->dyncast() != DYNCAST_TYPE) |
1783 { error(loc, "%s is not a type", toChars()); | 1783 { error(loc, "%s is not a type", toChars()); |
1830 if (n2 >= 0x1000000) // put a 'reasonable' limit on it | 1830 if (n2 >= 0x1000000) // put a 'reasonable' limit on it |
1831 goto Loverflow; | 1831 goto Loverflow; |
1832 if (n && n2 / n != d2) | 1832 if (n && n2 / n != d2) |
1833 { | 1833 { |
1834 Loverflow: | 1834 Loverflow: |
1835 error(loc, "index %jd overflow for static array", d1); | 1835 error(loc, "index %lld overflow for static array", d1); |
1836 dim = new IntegerExp(0, 1, tsize_t); | 1836 dim = new IntegerExp(0, 1, tsize_t); |
1837 } | 1837 } |
1838 } | 1838 } |
1839 } | 1839 } |
1840 switch (tbn->ty) | 1840 switch (tbn->ty) |
1844 assert(dim); | 1844 assert(dim); |
1845 TypeTuple *tt = (TypeTuple *)tbn; | 1845 TypeTuple *tt = (TypeTuple *)tbn; |
1846 uinteger_t d = dim->toUInteger(); | 1846 uinteger_t d = dim->toUInteger(); |
1847 | 1847 |
1848 if (d >= tt->arguments->dim) | 1848 if (d >= tt->arguments->dim) |
1849 { error(loc, "tuple index %ju exceeds %u", d, tt->arguments->dim); | 1849 { error(loc, "tuple index %llu exceeds %u", d, tt->arguments->dim); |
1850 return Type::terror; | 1850 return Type::terror; |
1851 } | 1851 } |
1852 Argument *arg = (Argument *)tt->arguments->data[(size_t)d]; | 1852 Argument *arg = (Argument *)tt->arguments->data[(size_t)d]; |
1853 return arg->type; | 1853 return arg->type; |
1854 } | 1854 } |
1865 | 1865 |
1866 void TypeSArray::toDecoBuffer(OutBuffer *buf) | 1866 void TypeSArray::toDecoBuffer(OutBuffer *buf) |
1867 { | 1867 { |
1868 buf->writeByte(mangleChar[ty]); | 1868 buf->writeByte(mangleChar[ty]); |
1869 if (dim) | 1869 if (dim) |
1870 buf->printf("%ju", dim->toInteger()); | 1870 buf->printf("%llu", dim->toInteger()); |
1871 if (next) | 1871 if (next) |
1872 next->toDecoBuffer(buf); | 1872 next->toDecoBuffer(buf); |
1873 } | 1873 } |
1874 | 1874 |
1875 void TypeSArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) | 1875 void TypeSArray::toCBuffer2(OutBuffer *buf, HdrGenState *hgs, int mod) |
4963 upr = semanticLength(sc, tbn, upr); | 4963 upr = semanticLength(sc, tbn, upr); |
4964 upr = upr->optimize(WANTvalue); | 4964 upr = upr->optimize(WANTvalue); |
4965 uinteger_t i2 = upr->toUInteger(); | 4965 uinteger_t i2 = upr->toUInteger(); |
4966 | 4966 |
4967 if (!(i1 <= i2 && i2 <= tt->arguments->dim)) | 4967 if (!(i1 <= i2 && i2 <= tt->arguments->dim)) |
4968 { error(loc, "slice [%ju..%ju] is out of range of [0..%u]", i1, i2, tt->arguments->dim); | 4968 { error(loc, "slice [%llu..%llu] is out of range of [0..%u]", i1, i2, tt->arguments->dim); |
4969 return Type::terror; | 4969 return Type::terror; |
4970 } | 4970 } |
4971 | 4971 |
4972 Arguments *args = new Arguments; | 4972 Arguments *args = new Arguments; |
4973 args->reserve(i2 - i1); | 4973 args->reserve(i2 - i1); |
5008 uinteger_t i2 = upr->toUInteger(); | 5008 uinteger_t i2 = upr->toUInteger(); |
5009 | 5009 |
5010 sc = sc->pop(); | 5010 sc = sc->pop(); |
5011 | 5011 |
5012 if (!(i1 <= i2 && i2 <= td->objects->dim)) | 5012 if (!(i1 <= i2 && i2 <= td->objects->dim)) |
5013 { error(loc, "slice [%ju..%ju] is out of range of [0..%u]", i1, i2, td->objects->dim); | 5013 { error(loc, "slice [%llu..%llu] is out of range of [0..%u]", i1, i2, td->objects->dim); |
5014 goto Ldefault; | 5014 goto Ldefault; |
5015 } | 5015 } |
5016 | 5016 |
5017 if (i1 == 0 && i2 == td->objects->dim) | 5017 if (i1 == 0 && i2 == td->objects->dim) |
5018 { | 5018 { |