Skip to content

Commit 04695ba

Browse files
authored
Merge pull request #8314 from wilzbach/cherry-8249
change size_t to uint for OSX 64 bit merged-on-behalf-of: Razvan Nitu <RazvanN7@users.noreply.github.com>
2 parents 362059d + 50fa4b4 commit 04695ba

File tree

9 files changed

+17
-10
lines changed

9 files changed

+17
-10
lines changed

src/dmd/expression.d

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2561,6 +2561,11 @@ extern (C++) final class IntegerExp : Expression
25612561
return new IntegerExp(loc, value, type);
25622562
}
25632563

2564+
static IntegerExp createi(Loc loc, int value, Type type)
2565+
{
2566+
return new IntegerExp(loc, value, type);
2567+
}
2568+
25642569
override bool equals(RootObject o)
25652570
{
25662571
if (this == o)

src/dmd/expression.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,7 @@ class IntegerExp : public Expression
226226
dinteger_t value;
227227

228228
static IntegerExp *create(Loc loc, dinteger_t value, Type *type);
229+
static IntegerExp *createi(Loc loc, int value, Type *type);
229230
bool equals(RootObject *o);
230231
dinteger_t toInteger();
231232
real_t toReal();

src/dmd/func.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2197,7 +2197,7 @@ extern (C++) class FuncDeclaration : Declaration
21972197
*/
21982198
static FuncDeclaration genCfunc(Parameters* fparams, Type treturn, const(char)* name, StorageClass stc = 0)
21992199
{
2200-
return genCfunc(fparams, treturn, Identifier.idPool(name, strlen(name)), stc);
2200+
return genCfunc(fparams, treturn, Identifier.idPool(name, cast(uint)strlen(name)), stc);
22012201
}
22022202

22032203
static FuncDeclaration genCfunc(Parameters* fparams, Type treturn, Identifier id, StorageClass stc = 0)

src/dmd/identifier.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,10 @@ nothrow:
143143
*/
144144
extern (D) static Identifier idPool(const(char)[] s)
145145
{
146-
return idPool(s.ptr, s.length);
146+
return idPool(s.ptr, cast(uint)s.length);
147147
}
148148

149-
static Identifier idPool(const(char)* s, size_t len)
149+
static Identifier idPool(const(char)* s, uint len)
150150
{
151151
StringValue* sv = stringtable.update(s, len);
152152
Identifier id = cast(Identifier)sv.ptrvalue;

src/dmd/identifier.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
#endif /* __DMC__ */
1717

1818
#include "root.h"
19+
#include "rmem.h"
1920
#include "stringtable.h"
2021

2122
class Identifier : public RootObject
@@ -38,7 +39,7 @@ class Identifier : public RootObject
3839
static StringTable stringtable;
3940
static Identifier *generateId(const char *prefix);
4041
static Identifier *generateId(const char *prefix, size_t i);
41-
static Identifier *idPool(const char *s, size_t len);
42+
static Identifier *idPool(const char *s, unsigned len);
4243

4344
static inline Identifier *idPool(const char *s)
4445
{

src/dmd/lexer.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ class Lexer : ErrorHandler
494494
}
495495
break;
496496
}
497-
Identifier id = Identifier.idPool(cast(char*)t.ptr, p - t.ptr);
497+
Identifier id = Identifier.idPool(cast(char*)t.ptr, cast(uint)(p - t.ptr));
498498
t.ident = id;
499499
t.value = cast(TOK)id.getValue();
500500
anyToken = 1;

src/dmd/mars.d

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -666,7 +666,7 @@ private int tryMain(size_t argc, const(char)** argv)
666666
/* At this point, name is the D source file name stripped of
667667
* its path and extension.
668668
*/
669-
auto id = Identifier.idPool(name, strlen(name));
669+
auto id = Identifier.idPool(name, cast(uint)strlen(name));
670670
auto m = new Module(files[i], id, global.params.doDocComments, global.params.doHdrGeneration);
671671
modules.push(m);
672672
if (firstmodule)
@@ -2479,7 +2479,7 @@ private void parseModulePattern(const(char)* modulePattern, MatcherNode* dst, us
24792479
if (*modulePattern == '.')
24802480
{
24812481
assert(modulePattern > idStart, "empty module pattern");
2482-
*dst = MatcherNode(Identifier.idPool(idStart, modulePattern - idStart));
2482+
*dst = MatcherNode(Identifier.idPool(idStart, cast(uint)(modulePattern - idStart)));
24832483
modulePattern++;
24842484
idStart = modulePattern;
24852485
break;
@@ -2491,7 +2491,7 @@ private void parseModulePattern(const(char)* modulePattern, MatcherNode* dst, us
24912491
if (*modulePattern == '\0')
24922492
{
24932493
assert(modulePattern > idStart, "empty module pattern");
2494-
*lastNode = MatcherNode(Identifier.idPool(idStart, modulePattern - idStart));
2494+
*lastNode = MatcherNode(Identifier.idPool(idStart, cast(uint)(modulePattern - idStart)));
24952495
break;
24962496
}
24972497
}

src/dmd/mtype.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5629,7 +5629,7 @@ extern (C++) abstract class TypeQualified : Type
56295629
/* Look for what user might have intended
56305630
*/
56315631
const p = mutableOf().unSharedOf().toChars();
5632-
auto id = Identifier.idPool(p, strlen(p));
5632+
auto id = Identifier.idPool(p, cast(uint)strlen(p));
56335633
if (const n = importHint(p))
56345634
error(loc, "`%s` is not defined, perhaps `import %s;` ?", p, n);
56355635
else if (auto s2 = sc.search_correct(id))

src/tests/cxxfrontend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,7 +154,7 @@ void test_visitors()
154154
Loc loc;
155155
Identifier *ident = Identifier::idPool("test");
156156

157-
IntegerExp *ie = IntegerExp::create(loc, 42, Type::tint32);
157+
IntegerExp *ie = IntegerExp::createi(loc, 42, Type::tint32);
158158
ie->accept(&tv);
159159
assert(tv.expr == true);
160160

0 commit comments

Comments
 (0)