Cygwin: fix build with GCC 7
GCC 7 is able to see straight through this trick, so use a more formal method to avoid the warning. Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
This commit is contained in:
parent
cd31fbb2ae
commit
67609efeb0
|
@ -279,14 +279,6 @@ srandom(unsigned x)
|
||||||
(void)random();
|
(void)random();
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Avoid a compiler warning when we really want to get at the junk in
|
|
||||||
an uninitialized variable. */
|
|
||||||
static unsigned long
|
|
||||||
dummy (unsigned volatile long *x)
|
|
||||||
{
|
|
||||||
return *x;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* srandomdev:
|
* srandomdev:
|
||||||
*
|
*
|
||||||
|
@ -313,7 +305,11 @@ srandomdev()
|
||||||
unsigned long junk;
|
unsigned long junk;
|
||||||
|
|
||||||
gettimeofday(&tv, NULL);
|
gettimeofday(&tv, NULL);
|
||||||
srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ dummy(&junk));
|
/* Avoid a compiler warning when we really want to get at the
|
||||||
|
junk in an uninitialized variable. */
|
||||||
|
#pragma GCC diagnostic ignored "-Wmaybe-uninitialized"
|
||||||
|
srandom((getpid() << 16) ^ tv.tv_sec ^ tv.tv_usec ^ junk);
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue