diff options
author | Jirka Hladky <jhladky@redhat.com> | 2020-10-11 03:15:58 +0200 |
---|---|---|
committer | Jirka Hladky <jhladky@redhat.com> | 2020-10-11 03:15:58 +0200 |
commit | 36c2016fe3abf2e52915d775ba58b0afae25dc40 (patch) | |
tree | c284ae8708373b7aea00c66c38e94b2b3fcc312c | |
parent | Merge pull request #48 from ddstreet/write-wakeup-warn-only (diff) | |
download | haveged-36c2016fe3abf2e52915d775ba58b0afae25dc40.tar.xz haveged-36c2016fe3abf2e52915d775ba58b0afae25dc40.zip |
Fixed compiler warnings
-rw-r--r-- | src/havege.c | 9 | ||||
-rw-r--r-- | src/havegecmd.c | 4 | ||||
-rw-r--r-- | src/havegecollect.c | 6 | ||||
-rw-r--r-- | src/havegetest.c | 9 |
4 files changed, 22 insertions, 6 deletions
diff --git a/src/havege.c b/src/havege.c index 880e7fc..8200260 100644 --- a/src/havege.c +++ b/src/havege.c @@ -180,6 +180,8 @@ H_PTR havege_create( /* RETURN: app state */ return h; } +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" void havege_reparent( H_PTR hptr) { @@ -191,6 +193,7 @@ void havege_reparent( t->main = getpid(); #endif } +#pragma GCC diagnostic pop /** * Destructor. In a multi-collector build, this method should be called from a signal handler @@ -253,7 +256,7 @@ int havege_rng( /* RETURN: number words read */ buffer[i] = havege_ndread((H_COLLECT *)h->collector); h->error = ((H_COLLECT *)h->collector)->havege_err; #endif - return h->error==(H_UINT)H_NOERR? sz : -1; + return h->error==(H_UINT)H_NOERR? (int) sz : -1; } /** * Start the entropy collector. @@ -420,12 +423,16 @@ const char *havege_version(const char *version) /** * Place holder if output display not provided */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" static void havege_mute( /* RETURN: none */ const char *format, /* IN: printf format */ ...) /* IN: args */ { ; } +#pragma GCC diagnostic pop + #if NUMBER_CORES > 1 /** * Cleanup collector(s). In a multi-collector environment, need to kill diff --git a/src/havegecmd.c b/src/havegecmd.c index 5eb9146..18ff322 100644 --- a/src/havegecmd.c +++ b/src/havegecmd.c @@ -334,7 +334,7 @@ ssize_t safein( /* RETURN: read bytes */ break; error_exit("Unable to read from socket: %d", socket_fd); } - ptr += p; + ptr = (char *) ptr + p; ret += p; len -= p; } @@ -363,7 +363,7 @@ void safeout( /* RETURN: nothing */ break; error_exit("Unable to write to socket: %d", fd); } - ptr += p; + ptr = (char *) ptr + p; len -= p; } while (len > 0); diff --git a/src/havegecollect.c b/src/havegecollect.c index c83e961..2a75b1c 100644 --- a/src/havegecollect.c +++ b/src/havegecollect.c @@ -334,6 +334,10 @@ else if (0 != (h_ctxt->havege_raw & H_DEBUG_TEST_IN)) { return 1; } #endif + +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wpedantic" + loop_enter: LOOP(40,39) #include "oneiteration.h" @@ -417,6 +421,8 @@ LOOP(1,0) #include "oneiteration.h" LOOP(0,0) (void)havege_cp(h_ctxt, i,0,LOOP_PT(0)); +#pragma GCC diagnostic pop + loop_exit: return ANDPT==0? 0 : 1; } diff --git a/src/havegetest.c b/src/havegetest.c index b1376e7..98abfb7 100644 --- a/src/havegetest.c +++ b/src/havegetest.c @@ -167,6 +167,8 @@ static int testsDiscard( /* RETURN: non-zero to discard */ /** * Place holder for when report is not configured */ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wunused-parameter" static void testsMute( H_COLLECT * h_ctxt, /* IN-OUT: collector context */ H_UINT action, /* IN: A_RUN or B_RUN */ @@ -176,6 +178,7 @@ static void testsMute( { ; } +#pragma GCC diagnostic pop /** * The public wrapper that runs the tests. On the first call, the necessary machinery is built. * The calls to aisTest() actually run the tests. The test shared structure is read only in this @@ -581,7 +584,7 @@ static H_UINT aisTest( /* RETURN: nz if input needed */ * helpers are used to implement a high performance copyBit(). */ #define COPY_BYTE() {c = (*src<<bit_diff_ls)|(*(src+1)>>bit_diff_rs);src++;} -#define COPY_FIRST() if (xfr >= (8 - dst_bits)) {\ +#define COPY_FIRST() if ( (int) xfr >= (8 - dst_bits)) {\ *dst &= rm[dst_bits];\ xfr -= 8 - dst_bits;\ }\ @@ -829,7 +832,7 @@ static H_UINT test5( /* RETURN: updated bit offset */ * This test always uses the same data as test1 through test4 */ for (max = k = 0,tau=1;tau<=TEST5_LENGTH;tau++){ - Z_tau = abs(test5XOR(dp, tau) - 2500); + Z_tau = abs( (int) test5XOR(dp, tau) - 2500); if (Z_tau > max) { max = Z_tau; k = tau - 1; @@ -913,7 +916,7 @@ static H_UINT test6a( /* RETURN: bit offset */ } /* align to a word boundary, then shift gears to gobble words */ while((i+8) < r && (j+8) < AIS_LENGTH) { - if (0==((void *)bitstream_src - (void *)p->noise) % sizeof(H_UINT)) + if (0==((char *)bitstream_src - (char *)p->noise) % sizeof(H_UINT)) break; SIDEWAYS_ADD(c, *bitstream_src++); p->counter[0] += c; |