mirror of
https://github.com/dlang/dmd.git
synced 2025-04-27 05:30:13 +03:00
use SmallBuffer for directive
This commit is contained in:
parent
b1c0018702
commit
1e1cc72f96
7 changed files with 14 additions and 9 deletions
|
@ -1159,7 +1159,7 @@ bool OmfObj_includelib(scope const char[] name)
|
|||
* true if operation is supported
|
||||
*/
|
||||
|
||||
bool OmfObj_linkerdirective(const(char)* name)
|
||||
bool OmfObj_linkerdirective(scope const(char)* name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1436,7 +1436,7 @@ bool ElfObj_includelib(scope const char[] name)
|
|||
* Output linker directive.
|
||||
*/
|
||||
|
||||
bool ElfObj_linkerdirective(const(char)* name)
|
||||
bool ElfObj_linkerdirective(scope const(char)* name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -1550,7 +1550,7 @@ bool MachObj_includelib(scope const char[] name)
|
|||
* Output linker directive.
|
||||
*/
|
||||
|
||||
bool MachObj_linkerdirective(const(char)* name)
|
||||
bool MachObj_linkerdirective(scope const(char)* name)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -993,7 +993,7 @@ bool MsCoffObj_includelib(scope const char[] name)
|
|||
*/
|
||||
|
||||
@trusted
|
||||
bool MsCoffObj_linkerdirective(const(char)* directive)
|
||||
bool MsCoffObj_linkerdirective(scope const(char)* directive)
|
||||
{
|
||||
int seg = MsCoffObj_seg_drectve();
|
||||
//dbg_printf("MsCoffObj::linkerdirective(directive *%s)\n",directive);
|
||||
|
|
|
@ -123,7 +123,7 @@ else
|
|||
mixin(genRetVal("includelib(name)"));
|
||||
}
|
||||
|
||||
bool linkerdirective(const(char)* p)
|
||||
bool linkerdirective(scope const(char)* p)
|
||||
{
|
||||
mixin(genRetVal("linkerdirective(p)"));
|
||||
}
|
||||
|
|
|
@ -460,7 +460,7 @@ public void obj_startaddress(Symbol *s)
|
|||
return objmod.startaddress(s);
|
||||
}
|
||||
|
||||
public bool obj_linkerdirective(const(char)* directive)
|
||||
public bool obj_linkerdirective(scope const(char)* directive)
|
||||
{
|
||||
return objmod.linkerdirective(directive);
|
||||
}
|
||||
|
|
|
@ -18,6 +18,7 @@ import core.stdc.time;
|
|||
|
||||
import dmd.root.array;
|
||||
import dmd.common.outbuffer;
|
||||
import dmd.common.string : SmallBuffer;
|
||||
import dmd.root.rmem;
|
||||
import dmd.rootobject;
|
||||
|
||||
|
@ -820,10 +821,14 @@ void toObjFile(Dsymbol ds, bool multiobj)
|
|||
assert(e.op == EXP.string_);
|
||||
|
||||
StringExp se = e.isStringExp();
|
||||
char *directive = cast(char *)mem.xmalloc(se.numberOfCodeUnits() + 1);
|
||||
se.writeTo(directive, true);
|
||||
size_t length = se.numberOfCodeUnits() + 1;
|
||||
debug enum LEN = 2; else enum LEN = 20;
|
||||
char[LEN] buffer = void;
|
||||
SmallBuffer!char directive = SmallBuffer!char(length, buffer);
|
||||
|
||||
obj_linkerdirective(directive);
|
||||
se.writeTo(directive.ptr, true);
|
||||
|
||||
obj_linkerdirective(directive.ptr);
|
||||
}
|
||||
|
||||
visit(cast(AttribDeclaration)pd);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue