Skip to content

Commit

Permalink
Merge pull request #1871 from yebblies/stringcat
Browse files Browse the repository at this point in the history
Remove use of automatic adjacent string literal concatenation from phobos
  • Loading branch information
monarchdodra committed Jan 24, 2014
2 parents e24e537 + 918abc9 commit 31a5813
Show file tree
Hide file tree
Showing 26 changed files with 94 additions and 94 deletions.
12 changes: 6 additions & 6 deletions std/algorithm.d
Expand Up @@ -4799,8 +4799,8 @@ unittest
{
debug(std_algorithm) scope(success)
writeln("unittest @", __FILE__, ":", __LINE__, " done.");
string h = "/homes/aalexand/d/dmd/bin/../lib/libphobos.a(dmain2.o)"
"(.gnu.linkonce.tmain+0x74): In function `main' undefined reference"
string h = "/homes/aalexand/d/dmd/bin/../lib/libphobos.a(dmain2.o)"~
"(.gnu.linkonce.tmain+0x74): In function `main' undefined reference"~
" to `_Dmain':";
string[] ns = ["libphobos", "function", " undefined", "`", ":"];
foreach (n ; ns) {
Expand Down Expand Up @@ -7008,7 +7008,7 @@ minCount(alias pred = "a < b", Range)(Range range)
alias RetType = Tuple!(T, size_t);

static assert (is(typeof(RetType(range.front, 1))),
format("Error: Cannot call minCount on a %s, because it is not possible "
format("Error: Cannot call minCount on a %s, because it is not possible "~
"to copy the result value (a %s) into a Tuple.", Range.stringof, T.stringof));

enforce(!range.empty, "Can't count elements from an empty range");
Expand Down Expand Up @@ -7071,7 +7071,7 @@ minCount(alias pred = "a < b", Range)(Range range)
}
else
static assert(false,
format("Sorry, can't find the minCount of a %s: Don't know how "
format("Sorry, can't find the minCount of a %s: Don't know how "~
"to keep track of the smallest %s element.", Range.stringof, T.stringof));
}

Expand Down Expand Up @@ -10389,7 +10389,7 @@ bool isSorted(alias less = "a < b", Range)(Range r) if (isForwardRange!(Range))
if (!binaryFun!less(r[i + 1], r[i])) continue;
assert(
!binaryFun!less(r[i], r[i + 1]),
text("Predicate for isSorted is not antisymmetric. Both"
text("Predicate for isSorted is not antisymmetric. Both",
" pred(a, b) and pred(b, a) are true for a=", r[i],
" and b=", r[i+1], " in positions ", i, " and ",
i + 1));
Expand All @@ -10408,7 +10408,7 @@ bool isSorted(alias less = "a < b", Range)(Range r) if (isForwardRange!(Range))
// Check for antisymmetric predicate
assert(
!binaryFun!less(r.front, ahead.front),
text("Predicate for isSorted is not antisymmetric. Both"
text("Predicate for isSorted is not antisymmetric. Both",
" pred(a, b) and pred(b, a) are true for a=", r.front,
" and b=", ahead.front, " in positions ", i, " and ",
i + 1));
Expand Down
8 changes: 4 additions & 4 deletions std/bitmanip.d
Expand Up @@ -103,7 +103,7 @@ private template createAccessors(
{
// getter
enum result = "@property @safe "~T.stringof~" "~name~"() pure nothrow const { auto result = "
"("~store~" & "
~"("~store~" & "
~ myToString(maskAllElse) ~ ") >>"
~ myToString(offset) ~ ";"
~ (T.min < 0
Expand All @@ -116,9 +116,9 @@ private template createAccessors(
~"assert(v >= "~name~"_min); "
~"assert(v <= "~name~"_max); "
~store~" = cast(typeof("~store~"))"
" (("~store~" & ~cast(typeof("~store~"))"~myToString(maskAllElse)~")"
" | ((cast(typeof("~store~")) v << "~myToString(offset)~")"
" & "~myToString(maskAllElse)~"));}\n"
~" (("~store~" & ~cast(typeof("~store~"))"~myToString(maskAllElse)~")"
~" | ((cast(typeof("~store~")) v << "~myToString(offset)~")"
~" & "~myToString(maskAllElse)~"));}\n"
// constants
~"enum "~T.stringof~" "~name~"_min = cast("~T.stringof~")"
~myToString(minVal)~"; "
Expand Down
6 changes: 3 additions & 3 deletions std/concurrency.d
Expand Up @@ -626,7 +626,7 @@ private void _send(T...)( MsgType type, Tid tid, T vals )
void receive(T...)( T ops )
in
{
assert(mbox !is null, "Cannot receive a message until a thread was spawned "
assert(mbox !is null, "Cannot receive a message until a thread was spawned "~
"or thisTid was passed to a running thread.");
}
body
Expand Down Expand Up @@ -708,7 +708,7 @@ private template receiveOnlyRet(T...)
receiveOnlyRet!(T) receiveOnly(T...)()
in
{
assert(mbox !is null, "Cannot receive a message until a thread was spawned "
assert(mbox !is null, "Cannot receive a message until a thread was spawned "~
"or thisTid was passed to a running thread.");
}
body
Expand Down Expand Up @@ -775,7 +775,7 @@ unittest
bool receiveTimeout(T...)( Duration duration, T ops )
in
{
assert(mbox !is null, "Cannot receive a message until a thread was spawned "
assert(mbox !is null, "Cannot receive a message until a thread was spawned "~
"or thisTid was passed to a running thread.");
}
body
Expand Down
4 changes: 2 additions & 2 deletions std/conv.d
Expand Up @@ -2403,7 +2403,7 @@ Target parse(Target, Source)(ref Source p)
{ case '-': sexp++;
goto case;
case '+': p.popFront(); enforce(!p.empty,
new ConvException("Error converting input"
new ConvException("Error converting input"~
" to floating point"));
break;
default: {}
Expand All @@ -2421,7 +2421,7 @@ Target parse(Target, Source)(ref Source p)
ndigits = 1;
}
exp += (sexp) ? -e : e;
enforce(ndigits, new ConvException("Error converting input"
enforce(ndigits, new ConvException("Error converting input"~
" to floating point"));

if (msdec)
Expand Down
8 changes: 4 additions & 4 deletions std/csv.d
Expand Up @@ -396,7 +396,7 @@ auto csvReader(Contents = string,
// Test standard iteration over input.
unittest
{
string str = `one,"two ""quoted"""` ~ "\n\"three\nnew line\",""\nfive,six";
string str = `one,"two ""quoted"""` ~ "\n\"three\nnew line\",\nfive,six";
auto records = csvReader(str);

int count;
Expand Down Expand Up @@ -700,7 +700,7 @@ unittest
return text[0];
}
}
auto ir = InputRange("Name,Occupation,Salary\r"d
auto ir = InputRange("Name,Occupation,Salary\r"d~
"Joe,Carpenter,300000\nFred,Blacksmith,400000\r\n"d);

foreach(record; csvReader(ir, cast(string[])null))
Expand Down Expand Up @@ -1178,7 +1178,7 @@ public:
if(_input.rowLength != 0)
if(_input.col != _input.rowLength)
throw new CSVException(
format("Row %s's length %s does not match "
format("Row %s's length %s does not match "~
"previous length of %s.", _input.row,
_input.col, _input.rowLength));
return;
Expand All @@ -1187,7 +1187,7 @@ public:
if(_input.rowLength != 0)
if(_input.col > _input.rowLength)
throw new CSVException(
format("Row %s's length %s does not match "
format("Row %s's length %s does not match "~
"previous length of %s.", _input.row,
_input.col, _input.rowLength));
}
Expand Down
2 changes: 1 addition & 1 deletion std/digest/crc.d
Expand Up @@ -296,7 +296,7 @@ unittest
digest = crc32Of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
assert(digest == cast(ubyte[])x"d2e6c21f");

digest = crc32Of("1234567890123456789012345678901234567890"
digest = crc32Of("1234567890123456789012345678901234567890"~
"1234567890123456789012345678901234567890");
assert(digest == cast(ubyte[])x"724aa97c");

Expand Down
4 changes: 2 additions & 2 deletions std/digest/digest.d
Expand Up @@ -883,7 +883,7 @@ class WrapperDigest(T) if(isDigest!T) : Digest
}
body
{
enum string msg = "Buffer needs to be at least " ~ digestLength!(T).stringof ~ " bytes "
enum string msg = "Buffer needs to be at least " ~ digestLength!(T).stringof ~ " bytes " ~
"big, check " ~ typeof(this).stringof ~ ".length!";
asArray!(digestLength!T)(buf, msg) = _digest.finish();
return buf[0 .. digestLength!T];
Expand Down Expand Up @@ -919,7 +919,7 @@ class WrapperDigest(T) if(isDigest!T) : Digest
}
body
{
enum string msg = "Buffer needs to be at least " ~ digestLength!(T).stringof ~ " bytes "
enum string msg = "Buffer needs to be at least " ~ digestLength!(T).stringof ~ " bytes " ~
"big, check " ~ typeof(this).stringof ~ ".length!";
asArray!(digestLength!T)(buf, msg) = _digest.peek();
return buf[0 .. digestLength!T];
Expand Down
2 changes: 1 addition & 1 deletion std/digest/md.d
Expand Up @@ -467,7 +467,7 @@ unittest
digest = md5Of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
assert(digest == cast(ubyte[])x"d174ab98d277d9f5a5611c2c9f419d9f");

digest = md5Of("1234567890123456789012345678901234567890"
digest = md5Of("1234567890123456789012345678901234567890"~
"1234567890123456789012345678901234567890");
assert(digest == cast(ubyte[])x"57edf4a22be3c955ac49da2e2107b67a");

Expand Down
2 changes: 1 addition & 1 deletion std/digest/ripemd.d
Expand Up @@ -629,7 +629,7 @@ unittest
digest = ripemd160Of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
assert(digest == cast(ubyte[])x"b0e20b6e3116640286ed3a87a5713079b21f5189");

digest = ripemd160Of("1234567890123456789012345678901234567890"
digest = ripemd160Of("1234567890123456789012345678901234567890"~
"1234567890123456789012345678901234567890");
assert(digest == cast(ubyte[])x"9b752e45573d4b39f4dbd3323cab82bf63326bfb");

Expand Down
2 changes: 1 addition & 1 deletion std/digest/sha.d
Expand Up @@ -528,7 +528,7 @@ unittest
digest = sha1Of("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789");
assert(digest == cast(ubyte[])x"761c457bf73b14d27e9e9265c46f4b4dda11f940");

digest = sha1Of("1234567890123456789012345678901234567890"
digest = sha1Of("1234567890123456789012345678901234567890"~
"1234567890123456789012345678901234567890");
assert(digest == cast(ubyte[])x"50abf5706a150990a08b2c5ea40fa0e585554732");

Expand Down
8 changes: 4 additions & 4 deletions std/encoding.d
Expand Up @@ -819,9 +819,9 @@ template EncoderInstance(CharType : Windows1252Char)
}

immutable wstring charMap =
"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021"
"\u02C6\u2030\u0160\u2039\u0152\uFFFD\u017D\uFFFD"
"\uFFFD\u2018\u2019\u201C\u201D\u2022\u2103\u2014"
"\u20AC\uFFFD\u201A\u0192\u201E\u2026\u2020\u2021"~
"\u02C6\u2030\u0160\u2039\u0152\uFFFD\u017D\uFFFD"~
"\uFFFD\u2018\u2019\u201C\u201D\u2022\u2103\u2014"~
"\u02DC\u2122\u0161\u203A\u0153\uFFFD\u017E\u0178"
;

Expand Down Expand Up @@ -2463,7 +2463,7 @@ class EncodingSchemeASCII : EncodingScheme
"ISO_646.irv:1991",
"US-ASCII",
"cp367",
"csASCII"
"csASCII",
"iso-ir-6",
"us"
];
Expand Down
4 changes: 2 additions & 2 deletions std/exception.d
Expand Up @@ -410,11 +410,11 @@ unittest
"delegate void() " ~
(EncloseSafe ? "@safe " : "") ~
(EnclosePure ? "pure " : "") ~
"{ ""enforce(true, { "
"{ enforce(true, { " ~
"int n; " ~
(BodySafe ? "" : "auto p = &n + 10; " ) ~ // unsafe code
(BodyPure ? "" : "static int g; g = 10; ") ~ // impure code
"}); "
"}); " ~
"}";
enum expect =
(BodySafe || !EncloseSafe) && (!EnclosePure || BodyPure);
Expand Down
4 changes: 2 additions & 2 deletions std/internal/math/biguintx86.d
Expand Up @@ -139,7 +139,7 @@ L_unrolled:
~ indexedLoopUnroll( 8,
"mov EAX, [@*4-8*4+EDX+ECX*4];"
~ ( op == '+' ? "adc" : "sbb" ) ~ " EAX, [@*4-8*4+ESI+ECX*4];"
"mov [@*4-8*4+EDI+ECX*4], EAX;")
~ "mov [@*4-8*4+EDI+ECX*4], EAX;")
~ "}");
asm {
setc AL; // save carry
Expand All @@ -156,7 +156,7 @@ L_residual:
~ indexedLoopUnroll( 1,
"mov EAX, [@*4+EDX+ECX*4];"
~ ( op == '+' ? "adc" : "sbb" ) ~ " EAX, [@*4+ESI+ECX*4];"
"mov [@*4+EDI+ECX*4], EAX;") ~ "}");
~ "mov [@*4+EDI+ECX*4], EAX;") ~ "}");
asm {
setc AL; // save carry
add ECX, 1;
Expand Down
4 changes: 2 additions & 2 deletions std/math.d
Expand Up @@ -162,14 +162,14 @@ version(LittleEndian)
{
static assert(real.mant_dig == 53 || real.mant_dig==64
|| real.mant_dig == 113,
"Only 64-bit, 80-bit, and 128-bit reals"
"Only 64-bit, 80-bit, and 128-bit reals"~
" are supported for LittleEndian CPUs");
}
else
{
static assert(real.mant_dig == 53 || real.mant_dig==106
|| real.mant_dig == 113,
"Only 64-bit and 128-bit reals are supported for BigEndian CPUs."
"Only 64-bit and 128-bit reals are supported for BigEndian CPUs."~
" double-double reals have partial support");
}

Expand Down
12 changes: 6 additions & 6 deletions std/net/curl.d
Expand Up @@ -3748,7 +3748,7 @@ struct Curl
{
_onReceiveHeader = (in char[] od)
{
throwOnStopped("Receive header callback called on "
throwOnStopped("Receive header callback called on "~
"cleaned up Curl instance");
callback(od);
};
Expand Down Expand Up @@ -3866,7 +3866,7 @@ struct Curl
{
_onSocketOption = (curl_socket_t sock, CurlSockType st)
{
throwOnStopped("Socket option callback called on "
throwOnStopped("Socket option callback called on "~
"cleaned up Curl instance");
return callback(sock, st);
};
Expand Down Expand Up @@ -3908,7 +3908,7 @@ struct Curl
{
_onProgress = (size_t dlt, size_t dln, size_t ult, size_t uln)
{
throwOnStopped("Progress callback called on cleaned "
throwOnStopped("Progress callback called on cleaned "~
"up Curl instance");
return callback(dlt, dln, ult, uln);
};
Expand Down Expand Up @@ -4186,9 +4186,9 @@ private static size_t _receiveAsyncLines(Terminator, Unit)
// onReceive. Can be up to a max of 4 bytes.
enforceEx!CurlException(data.length <= 4,
format(
"Too many bytes left not decoded %s"
" > 4. Maybe the charset specified in"
" headers does not match "
"Too many bytes left not decoded %s"~
" > 4. Maybe the charset specified in"~
" headers does not match "~
"the actual content downloaded?",
data.length));
leftOverBytes ~= data;
Expand Down

0 comments on commit 31a5813

Please sign in to comment.