public inbox for cygwin-patches@cygwin.com
 help / color / mirror / Atom feed
* [PATCH] cygwin: fix errors with GCC 5
@ 2016-02-12  2:27 Yaakov Selkowitz
  2016-02-12  9:31 ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Yaakov Selkowitz @ 2016-02-12  2:27 UTC (permalink / raw)
  To: cygwin-patches

GCC 5 switched from C89 to C11 by default, which implies a change from
GNU to C99 inline.

	winsup/cygwin/
	* exceptions.cc (exception::handle): Fix always-true boolean
	comparison warning.
	* include/cygwin/config.h (__getreent): Mark gnu_inline.
	* winbase.h (ilockcmpexch, ilockcmpexch64): Ditto.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
 winsup/cygwin/exceptions.cc           | 2 +-
 winsup/cygwin/include/cygwin/config.h | 1 +
 winsup/cygwin/winbase.h               | 2 ++
 3 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index c3a45d2..a50973b 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -645,7 +645,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
     me.andreas->leave ();	/* Return from a "san" caught fault */
 #endif
 
-  if (debugging && ++debugging < 500000)
+  if (debugging && ++debugging)
     {
       SetThreadPriority (hMainThread, THREAD_PRIORITY_NORMAL);
       return ExceptionContinueExecution;
diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index 58cff05..204826d 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -43,6 +43,7 @@ extern "C" {
 #else
 #include "../tlsoffsets.h"
 #endif
+__attribute__((gnu_inline))
 extern inline struct _reent *__getreent (void)
 {
   register char *ret;
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h
index 666f74a..1e825e4 100644
--- a/winsup/cygwin/winbase.h
+++ b/winsup/cygwin/winbase.h
@@ -11,6 +11,7 @@ details. */
 #ifndef _WINBASE2_H
 #define _WINBASE2_H
 
+__attribute__((gnu_inline))
 extern __inline__ LONG
 ilockcmpexch (volatile LONG *t, LONG v, LONG c)
 {
@@ -30,6 +31,7 @@ ilockcmpexch (volatile LONG *t, LONG v, LONG c)
 #undef InterlockedCompareExchangePointer
 
 #ifdef __x86_64__
+__attribute__((gnu_inline))
 extern __inline__ LONGLONG
 ilockcmpexch64 (volatile LONGLONG *t, LONGLONG v, LONGLONG c)
 {
-- 
2.7.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] cygwin: fix errors with GCC 5
  2016-02-12  2:27 [PATCH] cygwin: fix errors with GCC 5 Yaakov Selkowitz
@ 2016-02-12  9:31 ` Corinna Vinschen
  2016-02-12 17:27   ` [PATCH v2] " Yaakov Selkowitz
  0 siblings, 1 reply; 4+ messages in thread
From: Corinna Vinschen @ 2016-02-12  9:31 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 1617 bytes --]

Hi Yaakov,

On Feb 11 20:26, Yaakov Selkowitz wrote:
> GCC 5 switched from C89 to C11 by default, which implies a change from
> GNU to C99 inline.
> 
> 	winsup/cygwin/
> 	* exceptions.cc (exception::handle): Fix always-true boolean
> 	comparison warning.
> 	* include/cygwin/config.h (__getreent): Mark gnu_inline.
> 	* winbase.h (ilockcmpexch, ilockcmpexch64): Ditto.
> 
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
> ---
>  winsup/cygwin/exceptions.cc           | 2 +-
>  winsup/cygwin/include/cygwin/config.h | 1 +
>  winsup/cygwin/winbase.h               | 2 ++
>  3 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
> index c3a45d2..a50973b 100644
> --- a/winsup/cygwin/exceptions.cc
> +++ b/winsup/cygwin/exceptions.cc
> @@ -645,7 +645,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
>      me.andreas->leave ();	/* Return from a "san" caught fault */
>  #endif
>  
> -  if (debugging && ++debugging < 500000)
> +  if (debugging && ++debugging)

This is not the right fix.  debugging is still a bool and you changed
the condition just to get rid of the warning.  The right fix is to keep
the condition and change the type of debugging to, e.g, int.  The
gnu_inline snippets are ok, but I'd like to see a description of what
effect this is fixing in the git comment, for future reference.


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH v2] cygwin: fix errors with GCC 5
  2016-02-12  9:31 ` Corinna Vinschen
@ 2016-02-12 17:27   ` Yaakov Selkowitz
  2016-02-12 17:46     ` Corinna Vinschen
  0 siblings, 1 reply; 4+ messages in thread
From: Yaakov Selkowitz @ 2016-02-12 17:27 UTC (permalink / raw)
  To: cygwin-patches

GCC 5 switched from C89 to C11 by default. This implies a change from
GNU to C99 inline by default, which have very different meanings of
extern inline vs. static inline:

https://gcc.gnu.org/onlinedocs/gcc/Inline.html

Marking these as gnu_inline retains the previous behaviour.

	winsup/cygwin/
	* exceptions.cc (exception::handle): Change debugging to int to fix
	an always-true boolean comparison warning.
	* include/cygwin/config.h (__getreent): Mark gnu_inline.
	* winbase.h (ilockcmpexch, ilockcmpexch64): Ditto.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>
---
 winsup/cygwin/exceptions.cc           | 4 ++--
 winsup/cygwin/include/cygwin/config.h | 1 +
 winsup/cygwin/winbase.h               | 2 ++
 3 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/winsup/cygwin/exceptions.cc b/winsup/cygwin/exceptions.cc
index c3a45d2..1627d43 100644
--- a/winsup/cygwin/exceptions.cc
+++ b/winsup/cygwin/exceptions.cc
@@ -637,7 +637,7 @@ EXCEPTION_DISPOSITION
 exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
 		   PDISPATCHER_CONTEXT dispatch)
 {
-  static bool NO_COPY debugging;
+  static int NO_COPY debugging = 0;
   _cygtls& me = _my_tls;
 
 #ifndef __x86_64__
@@ -808,7 +808,7 @@ exception::handle (EXCEPTION_RECORD *e, exception_list *frame, CONTEXT *in,
     rtl_unwind (frame, e);
   else
     {
-      debugging = true;
+      debugging = 1;
       return ExceptionContinueExecution;
     }
 
diff --git a/winsup/cygwin/include/cygwin/config.h b/winsup/cygwin/include/cygwin/config.h
index 58cff05..204826d 100644
--- a/winsup/cygwin/include/cygwin/config.h
+++ b/winsup/cygwin/include/cygwin/config.h
@@ -43,6 +43,7 @@ extern "C" {
 #else
 #include "../tlsoffsets.h"
 #endif
+__attribute__((gnu_inline))
 extern inline struct _reent *__getreent (void)
 {
   register char *ret;
diff --git a/winsup/cygwin/winbase.h b/winsup/cygwin/winbase.h
index 666f74a..1e825e4 100644
--- a/winsup/cygwin/winbase.h
+++ b/winsup/cygwin/winbase.h
@@ -11,6 +11,7 @@ details. */
 #ifndef _WINBASE2_H
 #define _WINBASE2_H
 
+__attribute__((gnu_inline))
 extern __inline__ LONG
 ilockcmpexch (volatile LONG *t, LONG v, LONG c)
 {
@@ -30,6 +31,7 @@ ilockcmpexch (volatile LONG *t, LONG v, LONG c)
 #undef InterlockedCompareExchangePointer
 
 #ifdef __x86_64__
+__attribute__((gnu_inline))
 extern __inline__ LONGLONG
 ilockcmpexch64 (volatile LONGLONG *t, LONGLONG v, LONGLONG c)
 {
-- 
2.7.0

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] cygwin: fix errors with GCC 5
  2016-02-12 17:27   ` [PATCH v2] " Yaakov Selkowitz
@ 2016-02-12 17:46     ` Corinna Vinschen
  0 siblings, 0 replies; 4+ messages in thread
From: Corinna Vinschen @ 2016-02-12 17:46 UTC (permalink / raw)
  To: cygwin-patches

[-- Attachment #1: Type: text/plain, Size: 841 bytes --]

On Feb 12 11:27, Yaakov Selkowitz wrote:
> GCC 5 switched from C89 to C11 by default. This implies a change from
> GNU to C99 inline by default, which have very different meanings of
> extern inline vs. static inline:
> 
> https://gcc.gnu.org/onlinedocs/gcc/Inline.html
> 
> Marking these as gnu_inline retains the previous behaviour.
> 
> 	winsup/cygwin/
> 	* exceptions.cc (exception::handle): Change debugging to int to fix
> 	an always-true boolean comparison warning.
> 	* include/cygwin/config.h (__getreent): Mark gnu_inline.
> 	* winbase.h (ilockcmpexch, ilockcmpexch64): Ditto.
> 
> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

ACK


Thanks,
Corinna

-- 
Corinna Vinschen                  Please, send mails regarding Cygwin to
Cygwin Maintainer                 cygwin AT cygwin DOT com
Red Hat

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2016-02-12 17:46 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-02-12  2:27 [PATCH] cygwin: fix errors with GCC 5 Yaakov Selkowitz
2016-02-12  9:31 ` Corinna Vinschen
2016-02-12 17:27   ` [PATCH v2] " Yaakov Selkowitz
2016-02-12 17:46     ` Corinna Vinschen

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).