Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYaakov Selkowitz <yselkowi@redhat.com>2018-04-17 06:46:11 +0300
committerYaakov Selkowitz <yselkowi@redhat.com>2018-04-17 06:46:11 +0300
commit67609efeb0bcb198463a952a6a214813794a9c2b (patch)
treeea26fc938a24b58b315d3c21204f87b48efc9eea /winsup/cygwin/random.cc
parentcd31fbb2aea25f94d7ecedc9db16dfc87ab0c316 (diff)
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>
Diffstat (limited to 'winsup/cygwin/random.cc')
-rw-r--r--winsup/cygwin/random.cc14
1 files changed, 5 insertions, 9 deletions
diff --git a/winsup/cygwin/random.cc b/winsup/cygwin/random.cc
index 802c33b8a..163fc040c 100644
--- a/winsup/cygwin/random.cc
+++ b/winsup/cygwin/random.cc
@@ -279,14 +279,6 @@ srandom(unsigned x)
(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:
*
@@ -313,7 +305,11 @@ srandomdev()
unsigned long junk;
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;
}