Skip to content

Commit

Permalink
Move complex/imaginary types from transition to deprecation
Browse files Browse the repository at this point in the history
  • Loading branch information
ibuclaw committed May 6, 2016
1 parent 58b204f commit 070aa5b
Show file tree
Hide file tree
Showing 7 changed files with 8 additions and 21 deletions.
3 changes: 1 addition & 2 deletions src/declaration.d
Original file line number Diff line number Diff line change
Expand Up @@ -1137,8 +1137,7 @@ public:
//printf("sc->stc = %x\n", sc->stc);
//printf("storage_class = x%x\n", storage_class);

if (global.params.vcomplex)
type.checkComplexTransition(loc);
type.checkComplexTransition(loc);

// Calculate type size + safety checks
if (sc.func && !sc.intypeof && !isMember())
Expand Down
6 changes: 2 additions & 4 deletions src/expression.d
Original file line number Diff line number Diff line change
Expand Up @@ -5566,8 +5566,7 @@ public:
else
assert(0);

if (global.params.vcomplex)
type.checkComplexTransition(loc);
type.checkComplexTransition(loc);

return e;
}
Expand Down Expand Up @@ -7238,8 +7237,7 @@ public:
return new ErrorExp();
}

if (global.params.vcomplex)
ta.checkComplexTransition(loc);
ta.checkComplexTransition(loc);

Expression e;
if (ea && ta.toBasetype().ty == Tclass)
Expand Down
2 changes: 1 addition & 1 deletion src/func.d
Original file line number Diff line number Diff line change
Expand Up @@ -1706,7 +1706,7 @@ public:
if (f.checkRetType(loc))
fbody = new ErrorStatement();
}
if (global.params.vcomplex && f.next !is null)
if (f.next !is null)
f.next.checkComplexTransition(loc);

if (returns && !fbody.isErrorStatement())
Expand Down
1 change: 0 additions & 1 deletion src/globals.d
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ struct Param
bool vtls; // identify thread local variables
bool vgc; // identify gc usage
bool vfield; // identify non-mutable field variables
bool vcomplex; // identify complex/imaginary type usage
ubyte symdebug; // insert debug symbolic information
bool alwaysframe; // always emit standard stack frame
bool optimize; // run optimizer
Expand Down
1 change: 0 additions & 1 deletion src/globals.h
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ struct Param
bool vtls; // identify thread local variables
char vgc; // identify gc usage
bool vfield; // identify non-mutable field variables
bool vcomplex; // identify complex/imaginary type usage
char symdebug; // insert debug symbolic information
bool alwaysframe; // always emit standard stack frame
bool optimize; // run optimizer
Expand Down
8 changes: 0 additions & 8 deletions src/mars.d
Original file line number Diff line number Diff line change
Expand Up @@ -613,7 +613,6 @@ private int tryMain(size_t argc, const(char)** argv)
Language changes listed by -transition=id:
=all list information on all language changes
=checkimports give deprecation messages about 10378 anomalies
=complex,14488 list all usages of complex or imaginary types
=field,3449 list all non-mutable fields which occupy an object instance
=import,10378 revert to single phase name lookup
=tls list all variables going into thread local storage
Expand All @@ -636,9 +635,6 @@ Language changes listed by -transition=id:
case 10378:
global.params.bug10378 = true;
break;
case 14488:
global.params.vcomplex = true;
break;
default:
goto Lerror;
}
Expand All @@ -651,14 +647,10 @@ Language changes listed by -transition=id:
case "all":
global.params.vtls = true;
global.params.vfield = true;
global.params.vcomplex = true;
break;
case "checkimports":
global.params.check10378 = true;
break;
case "complex":
global.params.vcomplex = true;
break;
case "field":
global.params.vfield = true;
break;
Expand Down
8 changes: 4 additions & 4 deletions src/mtype.d
Original file line number Diff line number Diff line change
Expand Up @@ -2867,7 +2867,7 @@ public:

/*************************************
* Bugzilla 14488: Check if the inner most base type is complex or imaginary.
* Should only give alerts when set to emit transitional messages.
* Should only give alerts when deprecations are enabled.
*/
final void checkComplexTransition(Loc loc)
{
Expand All @@ -2876,7 +2876,6 @@ public:
t = t.nextOf().baseElemOf();
if (t.isimaginary() || t.iscomplex())
{
const(char)* p = loc.toChars();
Type rt;
switch (t.ty)
{
Expand All @@ -2895,13 +2894,14 @@ public:
default:
assert(0);
}

if (t.iscomplex())
{
fprintf(global.stdmsg, "%s: use of complex type '%s' is scheduled for deprecation, use 'std.complex.Complex!(%s)' instead\n", p ? p : "", toChars(), rt.toChars());
.deprecation(loc, "use of complex type '%s' is scheduled for deprecation, use 'std.complex.Complex!(%s)' instead\n", toChars(), rt.toChars());
}
else
{
fprintf(global.stdmsg, "%s: use of imaginary type '%s' is scheduled for deprecation, use '%s' instead\n", p ? p : "", toChars(), rt.toChars());
.deprecation(loc, "use of imaginary type '%s' is scheduled for deprecation, use '%s' instead\n", toChars(), rt.toChars());
}
}
}
Expand Down

0 comments on commit 070aa5b

Please sign in to comment.