mirror of
https://github.com/dlang/dmd.git
synced 2025-04-26 21:21:48 +03:00
Add more @safe
annotations
This commit is contained in:
parent
4ccb01fde5
commit
76d2c08fde
14 changed files with 22 additions and 25 deletions
|
@ -328,7 +328,6 @@ void WRdefnod(ref GlobalOptimizer go)
|
|||
}
|
||||
}
|
||||
|
||||
@trusted
|
||||
const(char)* fl_str(FL fl)
|
||||
{
|
||||
immutable char*[FLMAX] fls =
|
||||
|
|
|
@ -287,7 +287,6 @@ bool tyvector(tym_t ty) { return tybasic(ty) >= TYfloat4 && tybasic(ty) <= TYull
|
|||
uint tyshort(tym_t ty) { return tytab[ty & 0xFF] & TYFLshort; }
|
||||
|
||||
/* Detect TYlong or TYulong */
|
||||
@trusted
|
||||
bool tylong(tym_t ty) { return tybasic(ty) == TYlong || tybasic(ty) == TYulong; }
|
||||
|
||||
/* Use to detect a pointer type */
|
||||
|
|
|
@ -2384,7 +2384,6 @@ private void loadcse(ref CodeBuilder cdb,elem *e,reg_t reg,regm_t regm)
|
|||
}
|
||||
|
||||
|
||||
@trusted
|
||||
void callcdxxx(ref CGstate cg, ref CodeBuilder cdb, elem *e, ref regm_t pretregs, OPER op)
|
||||
{
|
||||
(*cdxxx[op])(cg, cdb, e, pretregs);
|
||||
|
|
|
@ -51,7 +51,7 @@ import dmd.tokens;
|
|||
* Returns:
|
||||
* merged storage class
|
||||
*/
|
||||
StorageClass mergeFuncAttrs(StorageClass s1, const FuncDeclaration f) pure
|
||||
StorageClass mergeFuncAttrs(StorageClass s1, const FuncDeclaration f) pure @safe
|
||||
{
|
||||
if (!f)
|
||||
return s1;
|
||||
|
|
|
@ -247,7 +247,7 @@ struct OutBuffer
|
|||
/**
|
||||
* Writes a 16 bit value, no reserve check.
|
||||
*/
|
||||
nothrow
|
||||
nothrow @safe
|
||||
void write16n(int v)
|
||||
{
|
||||
auto x = cast(ushort) v;
|
||||
|
@ -367,7 +367,7 @@ struct OutBuffer
|
|||
}
|
||||
|
||||
// Position buffer to accept the specified number of bytes at offset
|
||||
void position(size_t where, size_t nbytes) nothrow
|
||||
void position(size_t where, size_t nbytes) nothrow @safe
|
||||
{
|
||||
if (where + nbytes > data.length)
|
||||
{
|
||||
|
|
|
@ -319,7 +319,7 @@ struct Triple
|
|||
Initializes Target settings to compile for the same target
|
||||
as the build compiler.
|
||||
*/
|
||||
void setTargetBuildDefaults(ref Target target)
|
||||
void setTargetBuildDefaults(ref Target target) @safe
|
||||
{
|
||||
target = target.init;
|
||||
target.os = defaultTargetOS();
|
||||
|
|
|
@ -253,13 +253,13 @@ extern (C++) struct Scope
|
|||
}
|
||||
|
||||
/// Copy flags from scope `other`
|
||||
extern(D) void copyFlagsFrom(Scope* other)
|
||||
extern(D) void copyFlagsFrom(Scope* other) @safe
|
||||
{
|
||||
this.bitFields = other.bitFields;
|
||||
}
|
||||
|
||||
/// Set all scope flags to their initial value
|
||||
extern(D) void resetAllFlags()
|
||||
extern(D) void resetAllFlags() @safe
|
||||
{
|
||||
this.bitFields = 0;
|
||||
}
|
||||
|
|
|
@ -4082,7 +4082,7 @@ private extern(C++) class AddMemberVisitor : Visitor
|
|||
Scope* sc;
|
||||
ScopeDsymbol sds;
|
||||
|
||||
this(Scope* sc, ScopeDsymbol sds)
|
||||
this(Scope* sc, ScopeDsymbol sds) @safe
|
||||
{
|
||||
this.sc = sc;
|
||||
this.sds = sds;
|
||||
|
@ -6045,7 +6045,7 @@ private extern(C++) class SearchVisitor : Visitor
|
|||
SearchOptFlags flags;
|
||||
Dsymbol result;
|
||||
|
||||
this(const ref Loc loc, Identifier ident, SearchOptFlags flags)
|
||||
this(const ref Loc loc, Identifier ident, SearchOptFlags flags) @safe
|
||||
{
|
||||
this.loc = loc;
|
||||
this.ident = ident;
|
||||
|
@ -6651,7 +6651,7 @@ private extern(C++) class SetScopeVisitor : Visitor
|
|||
alias visit = typeof(super).visit;
|
||||
Scope* sc;
|
||||
|
||||
this(Scope* sc)
|
||||
this(Scope* sc) @safe
|
||||
{
|
||||
this.sc = sc;
|
||||
}
|
||||
|
@ -6794,7 +6794,7 @@ extern(C++) class ImportAllVisitor : Visitor
|
|||
alias visit = typeof(super).visit;
|
||||
Scope* sc;
|
||||
|
||||
this(Scope* sc)
|
||||
this(Scope* sc) @safe
|
||||
{
|
||||
this.sc = sc;
|
||||
}
|
||||
|
@ -7037,7 +7037,7 @@ private extern(C++) class SetFieldOffsetVisitor : Visitor
|
|||
FieldState* fieldState;
|
||||
bool isunion;
|
||||
|
||||
this(AggregateDeclaration ad, FieldState* fieldState, bool isunion)
|
||||
this(AggregateDeclaration ad, FieldState* fieldState, bool isunion) @safe
|
||||
{
|
||||
this.ad = ad;
|
||||
this.fieldState = fieldState;
|
||||
|
|
|
@ -1880,7 +1880,7 @@ extern (C++) final class InterpExp : Expression
|
|||
|
||||
enum char NoPostfix = 0;
|
||||
|
||||
extern (D) this(const ref Loc loc, InterpolatedSet* set, char postfix = NoPostfix) scope
|
||||
extern (D) this(const ref Loc loc, InterpolatedSet* set, char postfix = NoPostfix) scope @safe
|
||||
{
|
||||
super(loc, EXP.interpolated);
|
||||
this.interpolatedSet = set;
|
||||
|
@ -4575,7 +4575,7 @@ extern (C++) class CatAssignExp : BinAssignExp
|
|||
{
|
||||
Expression lowering; // lowered druntime hook `_d_arrayappend{cTX,T}`
|
||||
|
||||
extern (D) this(const ref Loc loc, Expression e1, Expression e2)
|
||||
extern (D) this(const ref Loc loc, Expression e1, Expression e2) @safe
|
||||
{
|
||||
super(loc, EXP.concatenateAssign, e1, e2);
|
||||
}
|
||||
|
@ -5286,7 +5286,7 @@ extern (C++) final class ObjcClassReferenceExp : Expression
|
|||
{
|
||||
ClassDeclaration classDeclaration;
|
||||
|
||||
extern (D) this(const ref Loc loc, ClassDeclaration classDeclaration)
|
||||
extern (D) this(const ref Loc loc, ClassDeclaration classDeclaration) @safe
|
||||
{
|
||||
super(loc, EXP.objcClassReference);
|
||||
this.classDeclaration = classDeclaration;
|
||||
|
|
|
@ -2802,7 +2802,7 @@ void modifyReturns(FuncLiteralDeclaration fld, Scope* sc, Type tret)
|
|||
* Returns: `true` if the provided scope is the root
|
||||
* of the traits compiles list of scopes.
|
||||
*/
|
||||
bool isRootTraitsCompilesScope(Scope* sc)
|
||||
bool isRootTraitsCompilesScope(Scope* sc) @safe
|
||||
{
|
||||
return (sc.traitsCompiles) && !sc.func.skipCodegen;
|
||||
}
|
||||
|
|
|
@ -134,7 +134,7 @@ extern(C++) struct Verbose
|
|||
uint errorLimit = 20;
|
||||
uint errorSupplementLimit = 6; // Limit the number of supplemental messages for each error (0 means unlimited)
|
||||
|
||||
uint errorSupplementCount()
|
||||
uint errorSupplementCount() @safe
|
||||
{
|
||||
if (verbose)
|
||||
return uint.max;
|
||||
|
@ -256,7 +256,7 @@ extern (C++) struct Param
|
|||
const(char)* timeTraceFile; /// File path of output file
|
||||
|
||||
///
|
||||
bool parsingUnittestsRequired()
|
||||
bool parsingUnittestsRequired() @safe
|
||||
{
|
||||
return useUnitTests || ddoc.doOutput || dihdr.doOutput;
|
||||
}
|
||||
|
|
|
@ -277,7 +277,7 @@ nothrow:
|
|||
* Returns:
|
||||
* the slice
|
||||
*/
|
||||
extern (D) static const(char)[] sansExt(const char[] filename)
|
||||
extern (D) static const(char)[] sansExt(const char[] filename) @safe
|
||||
{
|
||||
auto e = ext(filename);
|
||||
size_t length = e.length;
|
||||
|
@ -1101,7 +1101,7 @@ nothrow:
|
|||
return str.ptr;
|
||||
}
|
||||
|
||||
const(char)[] toString() const pure nothrow @nogc @trusted
|
||||
const(char)[] toString() const pure nothrow @nogc @safe
|
||||
{
|
||||
return str;
|
||||
}
|
||||
|
|
|
@ -433,7 +433,7 @@ Returns:
|
|||
a `FindSplit` object that casts to `true` iff `needle` was found inside `str`.
|
||||
In that case, `split[1]` is the needle, and `split[0]`/`split[2]` are before/after the needle.
|
||||
*/
|
||||
FindSplit findSplit(return scope const(char)[] str, scope const(char)[] needle)
|
||||
FindSplit findSplit(return scope const(char)[] str, scope const(char)[] needle) @safe
|
||||
{
|
||||
if (needle.length > str.length)
|
||||
return FindSplit([str, null, null]);
|
||||
|
@ -469,7 +469,7 @@ Params:
|
|||
Returns:
|
||||
substring of `str` inbetween `l` and `r`
|
||||
*/
|
||||
const(char)[] findBetween(const(char)[] str, const(char)[] l, const(char)[] r)
|
||||
const(char)[] findBetween(const(char)[] str, const(char)[] l, const(char)[] r) @safe
|
||||
{
|
||||
if (auto s0 = str.findSplit(l))
|
||||
if (auto s1 = s0[2].findSplit(r))
|
||||
|
|
|
@ -237,7 +237,7 @@ bool parseDigits(T)(ref T val, const(char)[] p, const T max = T.max)
|
|||
* size = 1 for ubyte[], 2 for ushort[], 4 for uint[], 8 for ulong[]
|
||||
* Returns: copy of `data`, with bytes shuffled if compiled for `version(LittleEndian)`
|
||||
*/
|
||||
ubyte[] arrayCastBigEndian(const ubyte[] data, size_t size)
|
||||
ubyte[] arrayCastBigEndian(const ubyte[] data, size_t size) @safe
|
||||
{
|
||||
ubyte[] impl(T)()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue