Skip to content

Commit

Permalink
enable system variable check for unannotated functions
Browse files Browse the repository at this point in the history
  • Loading branch information
adamdruppe committed Jul 31, 2024
1 parent a5418fb commit db05a5a
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion compiler/src/dmd/expressionsem.d
Original file line number Diff line number Diff line change
Expand Up @@ -1471,7 +1471,7 @@ Lagain:
{
if (sd.isSystem())
{
if (sc.setUnsafePreview(global.params.systemVariables, false, loc,
if (sc.setUnsafe(false, loc,
"cannot access `@system` variable `%s` in @safe code", sd))
{
if (auto v = sd.isVarDeclaration())
Expand Down
2 changes: 1 addition & 1 deletion compiler/src/dmd/safe.d
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ bool checkUnsafeAccess(Scope* sc, Expression e, bool readonly, bool printmsg)
import dmd.globals : global;
if (v.isSystem())
{
if (sc.setUnsafePreview(global.params.systemVariables, !printmsg, e.loc,
if (sc.setUnsafe(!printmsg, e.loc,
"cannot access `@system` field `%s.%s` in `@safe` code", ad, v))
return true;
}
Expand Down
8 changes: 4 additions & 4 deletions druntime/src/core/internal/gc/impl/conservative/gc.d
Original file line number Diff line number Diff line change
Expand Up @@ -1460,7 +1460,7 @@ short[PAGESIZE / 16][Bins.B_NUMSMALL + 1] calcBinBase()
return bin;
}

size_t baseOffset(size_t offset, Bins bin) @nogc nothrow
size_t baseOffset(size_t offset, Bins bin) @nogc nothrow @system
{
assert(bin <= Bins.B_PAGE);
return (offset & ~(PAGESIZE - 1)) + binbase[bin][(offset & (PAGESIZE - 1)) >> 4];
Expand Down Expand Up @@ -1765,7 +1765,7 @@ struct Gcx
/**
*
*/
void runFinalizers(const scope void[] segment) nothrow
void runFinalizers(const scope void[] segment) nothrow @system
{
ConservativeGC._inFinalizer = true;
scope (failure) ConservativeGC._inFinalizer = false;
Expand Down Expand Up @@ -1920,7 +1920,7 @@ struct Gcx
: bigAlloc(size, alloc_size, bits, ti);
}

void* smallAlloc(size_t size, ref size_t alloc_size, uint bits, const TypeInfo ti) nothrow
void* smallAlloc(size_t size, ref size_t alloc_size, uint bits, const TypeInfo ti) nothrow @system
{
immutable bin = binTable[size];
alloc_size = binsize[bin];
Expand Down Expand Up @@ -3717,7 +3717,7 @@ struct Pool
/**
*
*/
uint getBits(size_t biti) nothrow
uint getBits(size_t biti) nothrow @system
{
uint bits;

Expand Down
4 changes: 2 additions & 2 deletions druntime/src/rt/aaA.d
Original file line number Diff line number Diff line change
Expand Up @@ -265,7 +265,7 @@ private bool hasDtor(const TypeInfo ti) pure nothrow
return false;
}

private immutable(void)* getRTInfo(const TypeInfo ti) pure nothrow
private immutable(void)* getRTInfo(const TypeInfo ti) pure nothrow @system
{
// classes are references
const isNoClass = ti && typeid(ti) !is typeid(TypeInfo_Class);
Expand Down Expand Up @@ -339,7 +339,7 @@ TypeInfo_Struct fakeEntryTI(ref Impl aa, const TypeInfo keyti, const TypeInfo va

// build appropriate RTInfo at runtime
immutable(void)* rtinfoEntry(ref Impl aa, immutable(size_t)* keyinfo,
immutable(size_t)* valinfo, size_t* rtinfoData, size_t rtinfoSize) pure nothrow
immutable(size_t)* valinfo, size_t* rtinfoData, size_t rtinfoSize) pure nothrow @system
{
enum bitsPerWord = 8 * size_t.sizeof;

Expand Down

0 comments on commit db05a5a

Please sign in to comment.