This is the mail archive of the
cygwin-patches
mailing list for the Cygwin project.
[PATCH] Fix compiler errors/warnings when compiling with -O3
- From: Evgeny Grin <k2k at yandex dot ru>
- To: cygwin-patches at cygwin dot com
- Date: Wed, 23 Sep 2015 18:20:20 +0300
- Subject: [PATCH] Fix compiler errors/warnings when compiling with -O3
- Authentication-results: sourceware.org; auth=none
GCC find more suspicious places with -O3. Cygwin use -Werror so uninitialized variables prevent compilations.
This patch allow compilation with CFLAGS='-O3' CXXFLAGS='-O3'.
---
winsup/cygwin/fhandler_socket.cc | 4 ++--
winsup/cygwin/regex/regcomp.c | 2 +-
2 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/winsup/cygwin/fhandler_socket.cc b/winsup/cygwin/fhandler_socket.cc
index ecb6198..658dca7 100644
--- a/winsup/cygwin/fhandler_socket.cc
+++ b/winsup/cygwin/fhandler_socket.cc
@@ -746,7 +746,7 @@ fhandler_socket::wait_for_events (const long event_mask, const DWORD flags)
return 0;
int ret;
- long events;
+ long events = 0;
while (!(ret = evaluate_events (event_mask, events, !(flags & MSG_PEEK)))
&& !events)
@@ -1160,7 +1160,7 @@ int
fhandler_socket::connect (const struct sockaddr *name, int namelen)
{
struct sockaddr_storage sst;
- int type;
+ int type = 0;
if (get_inet_addr (name, namelen, &sst, &namelen, &type, connect_secret)
== SOCKET_ERROR)
diff --git a/winsup/cygwin/regex/regcomp.c b/winsup/cygwin/regex/regcomp.c
index d68dcc3..554b43a 100644
--- a/winsup/cygwin/regex/regcomp.c
+++ b/winsup/cygwin/regex/regcomp.c
@@ -1246,7 +1246,7 @@ freeset(struct parse *p, cset *cs)
static wint_t
singleton(cset *cs)
{
- wint_t i, s, n;
+ wint_t i, s = OUT, n;
for (i = n = 0; i < NC; i++)
if (CHIN(cs, i)) {
--
2.5.1.windows.1