Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 5b700c4

Browse files
authored
Merge pull request #2305 from ibuclaw/bshedparens
[refactor] posix.mak: Enforce whitespace before opening parenthesis merged-on-behalf-of: Petar Kirov <ZombineDev@users.noreply.github.com>
2 parents 6741a95 + b3de9e4 commit 5b700c4

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

74 files changed

+1273
-1270
lines changed

posix.mak

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -371,6 +371,9 @@ style_lint:
371371
@echo "Check for trailing whitespace"
372372
$(GREP) -nr '[[:blank:]]$$' $(MANIFEST) ; test $$? -eq 1
373373

374+
@echo "Enforce whitespace before opening parenthesis"
375+
grep -nrE "\<(for|foreach|foreach_reverse|if|while|switch|catch)\(" $$(find src -name '*.d') ; test $$? -eq 1
376+
374377
.PHONY : auto-tester-build
375378
auto-tester-build: target checkwhitespace
376379

src/core/atomic.d

Lines changed: 80 additions & 80 deletions
Large diffs are not rendered by default.

src/core/bitop.d

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ If forward is false, bsr is computed (the index of the last set bit).
169169
-1 is returned if no bits are set (v == 0).
170170
*/
171171
private int softScan(N, bool forward)(N v) pure
172-
if(is(N == uint) || is(N == ulong))
172+
if (is(N == uint) || is(N == ulong))
173173
{
174174
// bsf() and bsr() are officially undefined for v == 0.
175175
if (!v)
@@ -251,7 +251,7 @@ unittest
251251

252252
foreach (b; 0 .. 64)
253253
{
254-
if(b < 32)
254+
if (b < 32)
255255
{
256256
assert(softBsf!uint(1u << b) == b);
257257
assert(softBsr!uint(1u << b) == b);
@@ -415,7 +415,7 @@ struct BitRange
415415
// clear the current bit
416416
auto curbit = idx % bitsPerWord;
417417
cur ^= size_t(1) << curbit;
418-
if(!cur)
418+
if (!cur)
419419
{
420420
// find next size_t with set bit
421421
idx -= curbit;
@@ -458,7 +458,7 @@ struct BitRange
458458
// iterate
459459
size_t testSum;
460460
size_t nBits;
461-
foreach(b; BitRange(bitArr, 100))
461+
foreach (b; BitRange(bitArr, 100))
462462
{
463463
testSum += b;
464464
++nBits;
@@ -478,10 +478,10 @@ struct BitRange
478478
size_t* bitArr = cast(size_t *)malloc(numBytes);
479479
scope(exit) free(bitArr);
480480
memset(bitArr, 0, numBytes);
481-
foreach(b; bitsToTest)
481+
foreach (b; bitsToTest)
482482
bts(bitArr, b);
483483
auto br = BitRange(bitArr, numBits);
484-
foreach(b; bitsToTest)
484+
foreach (b; bitsToTest)
485485
{
486486
assert(!br.empty);
487487
assert(b == br.front);
@@ -796,7 +796,7 @@ unittest
796796
static void test(alias impl)()
797797
{
798798
assert (impl( 0x8000_0100 ) == 0x0080_0001);
799-
foreach(i; 0 .. 32)
799+
foreach (i; 0 .. 32)
800800
assert (impl(1 << i) == 1 << 32 - i - 1);
801801
}
802802

src/core/checkedint.d

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ long muls(long x, long y, ref bool overflow)
572572
{
573573
immutable long r = cast(ulong)x * cast(ulong)y;
574574
enum not0or1 = ~1L;
575-
if((x & not0or1) && ((r == y)? r : (r / x) != y))
575+
if ((x & not0or1) && ((r == y)? r : (r / x) != y))
576576
overflow = true;
577577
return r;
578578
}
@@ -608,7 +608,7 @@ cent muls(cent x, cent y, ref bool overflow)
608608
{
609609
immutable cent r = cast(ucent)x * cast(ucent)y;
610610
enum not0or1 = ~1L;
611-
if((x & not0or1) && ((r == y)? r : (r / x) != y))
611+
if ((x & not0or1) && ((r == y)? r : (r / x) != y))
612612
overflow = true;
613613
return r;
614614
}

src/core/cpuid.d

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -551,7 +551,7 @@ void getcacheinfoCPUID2()
551551
void getcacheinfoCPUID4()
552552
{
553553
int cachenum = 0;
554-
for(;;) {
554+
for (;;) {
555555
uint a, b, number_of_sets;
556556
version(GNU) asm pure nothrow @nogc {
557557
"cpuid" : "=a" a, "=b" b, "=c" number_of_sets : "a" 4, "c" cachenum : "edx";

0 commit comments

Comments
 (0)