public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
From: Evgeny Grin <k2k@yandex.ru>
To: cygwin-patches@cygwin.com
Subject: [PATCH] Fix compiler errors/warnings when compiling with -O3
Date: Wed, 23 Sep 2015 15:20:00 -0000	[thread overview]
Message-ID: <754151443021620@web4g.yandex.ru> (raw)

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

             reply	other threads:[~2015-09-23 15:20 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-09-23 15:20 Evgeny Grin [this message]
2015-10-20 10:34 ` Corinna Vinschen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=754151443021620@web4g.yandex.ru \
    --to=k2k@yandex.ru \
    --cc=cygwin-patches@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).