summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChocobo1 <Chocobo1@users.noreply.github.com>2020-06-30 04:21:06 +0200
committerChocobo1 <Chocobo1@users.noreply.github.com>2020-06-30 04:33:44 +0200
commit497e00de20cdacbff1d572c0833544530121dac9 (patch)
tree9d5dc42ce0cef353ff16c180223f2832b24e022f
parentUse proper initializer (diff)
downloadhaveged-497e00de20cdacbff1d572c0833544530121dac9.tar.xz
haveged-497e00de20cdacbff1d572c0833544530121dac9.zip
Add fallthrough comment to switch cases
-rw-r--r--src/haveged.c5
-rw-r--r--src/havegetest.c16
-rw-r--r--src/havegetune.c2
3 files changed, 23 insertions, 0 deletions
diff --git a/src/haveged.c b/src/haveged.c
index aecd7f6..135dbcb 100644
--- a/src/haveged.c
+++ b/src/haveged.c
@@ -328,6 +328,7 @@ int main(int argc, char **argv)
case '?':
case 'h':
usage(0, nopts, long_options, cmds);
+ /* fallthrough */
case 'V':
printf(VERSION_TEXT, HAVEGE_PREP_VERSION);
exit(EXIT_SUCCESS);
@@ -762,12 +763,16 @@ static int get_runsize( /* RETURN: the size */
switch(*suffix) {
case 't': case 'T':
p2 += 1;
+ /* fallthrough */
case 'g': case 'G':
p2 += 1;
+ /* fallthrough */
case 'm': case 'M':
p2 += 1;
+ /* fallthrough */
case 'k': case 'K':
p2 += 1;
+ /* fallthrough */
case 0:
break;
default:
diff --git a/src/havegetest.c b/src/havegetest.c
index 8b423fb..b1376e7 100644
--- a/src/havegetest.c
+++ b/src/havegetest.c
@@ -251,10 +251,12 @@ static H_UINT aisProcedureA( /* RETURN: bits used */
case TEST_INIT:
p->bytesUsed = 0;
p->procRetry = 0;
+ /* fallthrough */
case TEST_RETRY:
p->procState = TEST_INPUT;
p->testState = TEST_INIT;
p->testId = p->testRun = 0;
+ /* fallthrough */
case TEST_INPUT:
p->data = (H_UINT8 *)buffer;
p->range = sz * sizeof(H_UINT) <<3;
@@ -277,6 +279,7 @@ static H_UINT aisProcedureA( /* RETURN: bits used */
else if (p->testState == TEST_INPUT)
return 0;
}
+ /* fallthrough */
case TEST_EVAL:
p->procState = TEST_DONE;
for (r = i = 0;i<p->testRun;i++)
@@ -330,10 +333,12 @@ static H_UINT aisProcedureB( /* RETURN: bits used */
case TEST_INIT:
p->bitsUsed = 0;
p->procRetry = 0;
+ /* fallthrough */
case TEST_RETRY:
p->testId = p->testNbr = 0;
p->procState = TEST_INPUT;
p->testState = TEST_INIT;
+ /* fallthrough */
case TEST_INPUT:
p->noise = buffer;
p->range = sz * BITS_PER_H_UINT;
@@ -353,6 +358,7 @@ static H_UINT aisProcedureB( /* RETURN: bits used */
context->szCarry = ct;
if (p->testState == TEST_INPUT)
return 0;
+ /* fallthrough */
case TEST_EVAL:
p->procState = TEST_DONE;
for (i=r=0;i<p->testNbr;i++)
@@ -408,6 +414,7 @@ static H_UINT aisSeq( /* RETURN: last bit index */
p->full = 0;
p->testState = TEST_INPUT;
SAVE(0,0,0);
+ /* fallthrough */
case TEST_INPUT:
RESTORE(j, hilf, deadman);
offs %= p->range;
@@ -451,6 +458,7 @@ static H_UINT aisSeq( /* RETURN: last bit index */
p->bitsUsed += i;
if (p->testState == TEST_INPUT)
break;
+ /* fallthrough */
case TEST_EVAL:
if (tid==1) {
double q[2];
@@ -690,10 +698,12 @@ static H_UINT fips140( /* RETURN: updated bit offset */
case TEST_INIT:
p->testState = TEST_INPUT;
p->bridge = 0;
+ /* fallthrough */
case TEST_INPUT:
offs = copyBits(p, offs, FIPS_USED);
if (p->testState!=TEST_EVAL)
break;
+ /* fallthrough */
case TEST_EVAL:
maxRun = ones = runLength = 0;
memset(poker, 0, 16*sizeof(H_UINT));
@@ -765,10 +775,12 @@ static H_UINT test0( /* RETURN: updated bit offset */
case TEST_INIT:
p->testState = TEST_INPUT;
p->bridge = 0;
+ /* fallthrough */
case TEST_INPUT:
offs = copyBits(p, offs, TEST0_USED);
if (p->testState!=TEST_EVAL)
break;
+ /* fallthrough */
case TEST_EVAL:
qsort(p->aux, TEST0_LENGTH, 6, test0cmp);
for (i=6,j=0;i<TEST0_LENGTH && j==0;i+=6)
@@ -888,6 +900,7 @@ static H_UINT test6a( /* RETURN: bit offset */
case TEST_INIT:
j = p->counter[0] = 0;
p->testState = TEST_INPUT;
+ /* fallthrough */
case TEST_INPUT:
{
BITSTREAM_OPEN(p->noise,offs);
@@ -923,6 +936,7 @@ static H_UINT test6a( /* RETURN: bit offset */
break;
}
}
+ /* fallthrough */
case TEST_EVAL:
p->results[p->testNbr].finalValue = (double)(p->counter[0]) / (double) AIS_LENGTH;
r = tid << 8;
@@ -958,6 +972,7 @@ static H_UINT test8( /* RETURN: bit offset */
memset(p->lastpos, 0, 256*sizeof(H_UINT));
SAVE8(0,0,0,0.0);
p->testState = TEST_INPUT;
+ /* fallthrough */
case TEST_INPUT:
RESTORE8(k,j,hilf,TG);
r = p->range - offs;
@@ -998,6 +1013,7 @@ static H_UINT test8( /* RETURN: bit offset */
p->bitsUsed += i;
if (p->testState == TEST_INPUT)
break;
+ /* fallthrough */
case TEST_EVAL:
tps->lastCoron = p->results[p->testNbr].finalValue = TG/(double)K;
r = tid<<8;
diff --git a/src/havegetune.c b/src/havegetune.c
index 19d3965..4b2c229 100644
--- a/src/havegetune.c
+++ b/src/havegetune.c
@@ -516,10 +516,12 @@ static void cpuid_configAmd(
for(i=0;i<n;i++)
cfg_bitSet(&w->cpuMap, i);
cfg_cpuAdd(anchor, SRC_CPUID_AMD8, w);
+ /* fallthrough */
case 6:
cpuid(0x80000006,0,regs);
cfg_cacheAdd(anchor, SRC_CPUID_AMD6, -1, 2, 'U', (regs[ECX]>>16) & 0xffff);
cfg_cacheAdd(anchor, SRC_CPUID_AMD6, -1, 3, 'U', ((regs[EDX]>>18) & 0x3fff)<<9);
+ /* fallthrough */
case 5:
cpuid(0x80000005,0,regs);
cfg_cacheAdd(anchor, SRC_CPUID_AMD5, -1, 1, 'D', (regs[ECX]>>24) & 0xff);