Mercurial > projects > ldc
comparison gen/toir.cpp @ 1372:229e02867307
Fix format-string bugs by adding __attribute__((__format__)) in all applicable
places and fixing all warnings my gcc produced.
Among other things, this should fix several segfaults (including one I just
ran into).
author | Frits van Bommel <fvbommel wxs.nl> |
---|---|
date | Sun, 17 May 2009 00:15:25 +0200 |
parents | 8026319762be |
children | 3fb15be5ab6d |
comparison
equal
deleted
inserted
replaced
1371:967d28b7febe | 1372:229e02867307 |
---|---|
311 | 311 |
312 ////////////////////////////////////////////////////////////////////////////////////////// | 312 ////////////////////////////////////////////////////////////////////////////////////////// |
313 | 313 |
314 LLConstant* RealExp::toConstElem(IRState* p) | 314 LLConstant* RealExp::toConstElem(IRState* p) |
315 { | 315 { |
316 Logger::print("RealExp::toConstElem: %s @ %s | %LX\n", toChars(), type->toChars(), value); | 316 Logger::print("RealExp::toConstElem: %s @ %s | %LX\n", toChars(), type->toChars(), |
317 0xFFFFFFFFFFUL & *(long long unsigned*)&value); | |
317 LOG_SCOPE; | 318 LOG_SCOPE; |
318 Type* t = type->toBasetype(); | 319 Type* t = type->toBasetype(); |
319 return DtoConstFP(t, value); | 320 return DtoConstFP(t, value); |
320 } | 321 } |
321 | 322 |
2471 // add initializer | 2472 // add initializer |
2472 Expression* expr = (it.index < nexprs) ? exprs[it.index] : NULL; | 2473 Expression* expr = (it.index < nexprs) ? exprs[it.index] : NULL; |
2473 IF_LOG Logger::println("expr: %p", expr); | 2474 IF_LOG Logger::println("expr: %p", expr); |
2474 if (expr) | 2475 if (expr) |
2475 { | 2476 { |
2476 IF_LOG Logger::println("expr = %s", it.index, expr->toChars()); | 2477 IF_LOG Logger::println("expr %zu = %s", it.index, expr->toChars()); |
2477 LLValue* v = DtoExprValue(vd->type, expr); | 2478 LLValue* v = DtoExprValue(vd->type, expr); |
2478 initvalues.push_back(v); | 2479 initvalues.push_back(v); |
2479 } | 2480 } |
2480 else | 2481 else |
2481 { | 2482 { |
2604 for (size_t i=0; i<n; ++i) | 2605 for (size_t i=0; i<n; ++i) |
2605 { | 2606 { |
2606 Expression* ekey = (Expression*)keys->data[i]; | 2607 Expression* ekey = (Expression*)keys->data[i]; |
2607 Expression* eval = (Expression*)values->data[i]; | 2608 Expression* eval = (Expression*)values->data[i]; |
2608 | 2609 |
2609 Logger::println("(%u) aa[%s] = %s", i, ekey->toChars(), eval->toChars()); | 2610 Logger::println("(%zu) aa[%s] = %s", i, ekey->toChars(), eval->toChars()); |
2610 | 2611 |
2611 // index | 2612 // index |
2612 DValue* key = ekey->toElem(p); | 2613 DValue* key = ekey->toElem(p); |
2613 DValue* mem = DtoAAIndex(loc, vtype, aa, key, true); | 2614 DValue* mem = DtoAAIndex(loc, vtype, aa, key, true); |
2614 | 2615 |