diff mbox series

Make __always_inline macro compatible with glibc

Message ID 20180116193052.11428-1-yselkowi@redhat.com
State New
Headers show
Series Make __always_inline macro compatible with glibc | expand

Commit Message

Yaakov Selkowitz Jan. 16, 2018, 7:30 p.m. UTC
For example, this is used when cross-compiling the Linux kernel on Cygwin.

Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

---
 newlib/libc/include/sys/cdefs.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

-- 
2.15.1

Comments

Corinna Vinschen Jan. 17, 2018, 7:43 a.m. UTC | #1
On Jan 16 13:30, Yaakov Selkowitz wrote:
> For example, this is used when cross-compiling the Linux kernel on Cygwin.

> 

> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

> ---

>  newlib/libc/include/sys/cdefs.h | 2 +-

>  1 file changed, 1 insertion(+), 1 deletion(-)

> 

> diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h

> index db5f2bf2d..fc564a5c6 100644

> --- a/newlib/libc/include/sys/cdefs.h

> +++ b/newlib/libc/include/sys/cdefs.h

> @@ -385,7 +385,7 @@

>  #endif

>  

>  #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)

> -#define	__always_inline	__attribute__((__always_inline__))

> +#define	__always_inline	__inline__ __attribute__((__always_inline__))

>  #else

>  #define	__always_inline

>  #endif

> -- 

> 2.15.1


ACK


Thanks,
Corinna

-- 
Corinna Vinschen
Cygwin Maintainer
Red Hat
Sebastian Huber Jan. 17, 2018, 9:42 a.m. UTC | #2
On 16/01/18 20:30, Yaakov Selkowitz wrote:
> For example, this is used when cross-compiling the Linux kernel on Cygwin.

>

> Signed-off-by: Yaakov Selkowitz <yselkowi@redhat.com>

> ---

>   newlib/libc/include/sys/cdefs.h | 2 +-

>   1 file changed, 1 insertion(+), 1 deletion(-)

>

> diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h

> index db5f2bf2d..fc564a5c6 100644

> --- a/newlib/libc/include/sys/cdefs.h

> +++ b/newlib/libc/include/sys/cdefs.h

> @@ -385,7 +385,7 @@

>   #endif

>   

>   #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)

> -#define	__always_inline	__attribute__((__always_inline__))

> +#define	__always_inline	__inline__ __attribute__((__always_inline__))

>   #else

>   #define	__always_inline

>   #endif


Which problem resolves this patch? I ask since I added this for FreeBSD 
compatibility and here the definition is still the same.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
Yaakov Selkowitz Jan. 17, 2018, 9:55 a.m. UTC | #3
On 2018-01-17 03:42, Sebastian Huber wrote:
> On 16/01/18 20:30, Yaakov Selkowitz wrote:

>> For example, this is used when cross-compiling the Linux kernel on

>> Cygwin.


^^^

> Which problem resolves this patch? I ask since I added this for FreeBSD

> compatibility and here the definition is still the same.


The Linux kernel's hostprogs use __always_inline without __inline__,
because glibc's __always_inline includes it.  Without this, you get a
number of "always_inline function might not be inlinable" errors.

-- 
Yaakov Selkowitz
Software Engineer - Platform Enablement Group
Red Hat, Inc.
Sebastian Huber Jan. 17, 2018, 10:24 a.m. UTC | #4
On 17/01/18 10:55, Yaakov Selkowitz wrote:
> On 2018-01-17 03:42, Sebastian Huber wrote:

>> On 16/01/18 20:30, Yaakov Selkowitz wrote:

>>> For example, this is used when cross-compiling the Linux kernel on

>>> Cygwin.

> ^^^

>

>> Which problem resolves this patch? I ask since I added this for FreeBSD

>> compatibility and here the definition is still the same.

> The Linux kernel's hostprogs use __always_inline without __inline__,

> because glibc's __always_inline includes it.  Without this, you get a

> number of "always_inline function might not be inlinable" errors.

>


Ok, it seems that you can repeat the inline keyword multiple times. So, a

static inline __always_inline void f(void);

causes no problems with this change.

-- 
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.huber@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
diff mbox series

Patch

diff --git a/newlib/libc/include/sys/cdefs.h b/newlib/libc/include/sys/cdefs.h
index db5f2bf2d..fc564a5c6 100644
--- a/newlib/libc/include/sys/cdefs.h
+++ b/newlib/libc/include/sys/cdefs.h
@@ -385,7 +385,7 @@ 
 #endif
 
 #if __GNUC_PREREQ__(3, 1) || (defined(__INTEL_COMPILER) && __INTEL_COMPILER >= 800)
-#define	__always_inline	__attribute__((__always_inline__))
+#define	__always_inline	__inline__ __attribute__((__always_inline__))
 #else
 #define	__always_inline
 #endif