delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp-workers/2011/01/05/17:42:06

X-Authentication-Warning: delorie.com: mail set sender to djgpp-workers-bounces using -f
X-Recipient: djgpp-workers AT delorie DOT com
X-Authenticated: #27081556
X-Provags-ID: V01U2FsdGVkX18O2eoY5TkOUYwFfuwqCKtgmFFw5h2De48NWFOilR
WtfqN/HC0EKIP5
From: Juan Manuel Guerrero <juan DOT guerrero AT gmx DOT de>
To: djgpp-workers AT delorie DOT com
Subject: Re: Multiple definition of rdtsc.
Date: Wed, 5 Jan 2011 23:42:23 +0100
User-Agent: KMail/1.9.10
References: <201101040113 DOT 25277 DOT juan DOT guerrero AT gmx DOT de> <201101041919 DOT 02681 DOT juan DOT guerrero AT gmx DOT de> <xnlj30pkmd DOT fsf AT envy DOT delorie DOT com>
In-Reply-To: <xnlj30pkmd.fsf@envy.delorie.com>
MIME-Version: 1.0
Message-Id: <201101052342.23544.juan.guerrero@gmx.de>
X-Y-GMX-Trusted: 0
Reply-To: djgpp-workers AT delorie DOT com

Am Dienstag, 4. Januar 2011 schrieben Sie:
> 
> I think __OPTIMIZE__ is far older than we need to worry about.  Even GCC
> 1.42 supports it :-)


Any objections if this is commited?

Regards,
Juan M. Guerrero



	* include/sys/cdefs.h:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  New macro _EXTERN_INLINE.

	* include/time.h:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Use _EXTERN_INLINE.

	* include/inlines/pc.h:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Use _EXTERN_INLINE.

	* include/libc/farptrgs.h:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Use _EXTERN_INLINE.

	* include/netinet/in.h:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Use _EXTERN_INLINE.

	* include/sys/farptr.h:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Use _EXTERN_INLINE.

	* src/libc/pc_hw/farptr/farptr.c:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Do not include sys/cdefs.h.

	* src/libc/pc_hw/timer/rdtsc.c:  Ensure that old GNU extern inline semantics
	are used (aka -fgnu89-inline).  Do not include sys/cdefs.h.




diff -aprNU3 djgpp.orig/include/inlines/pc.h djgpp/include/inlines/pc.h
--- djgpp.orig/include/inlines/pc.h	1998-06-28 22:00:48 +0000
+++ djgpp/include/inlines/pc.h	2011-01-05 23:29:06 +0000
@@ -1,13 +1,16 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#ifndef __dj_include_Inline_pc_h_
-#define __dj_include_Inline_pc_h_
+#ifndef __dj_include_inline_pc_h_
+#define __dj_include_inline_pc_h_
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
-extern __inline__ unsigned char
+#include <sys/cdefs.h>
+
+_EXTERN_INLINE unsigned char
 inportb (unsigned short _port)
 {
   unsigned char rv;
@@ -17,7 +20,7 @@ inportb (unsigned short _port)
   return rv;
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 inportw (unsigned short _port)
 {
   unsigned short rv;
@@ -27,7 +30,7 @@ inportw (unsigned short _port)
   return rv;
 }
 
-extern __inline__ unsigned long
+_EXTERN_INLINE unsigned long
 inportl (unsigned short _port)
 {
   unsigned long rv;
@@ -37,7 +40,7 @@ inportl (unsigned short _port)
   return rv;
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 outportb (unsigned short _port, unsigned char _data)
 {
   __asm__ __volatile__ ("outb %1, %0"
@@ -46,7 +49,7 @@ outportb (unsigned short _port, unsigned
 	    "a" (_data));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 outportw (unsigned short _port, unsigned short _data)
 {
   __asm__ __volatile__ ("outw %1, %0"
@@ -55,7 +58,7 @@ outportw (unsigned short _port, unsigned
 	    "a" (_data));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 outportl (unsigned short _port, unsigned long _data)
 {
   __asm__ __volatile__ ("outl %1, %0"
@@ -68,4 +71,4 @@ outportl (unsigned short _port, unsigned
 }
 #endif
 
-#endif
+#endif /* !__dj_include_inline_pc_h_ */
diff -aprNU3 djgpp.orig/include/libc/farptrgs.h djgpp/include/libc/farptrgs.h
--- djgpp.orig/include/libc/farptrgs.h	2003-02-04 20:24:52 +0000
+++ djgpp/include/libc/farptrgs.h	2011-01-05 23:29:06 +0000
@@ -1,5 +1,6 @@
 /* special version for libc - uses %gs instead of %fs.  Ignore comments */
 
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (c) 1995 DJ Delorie.  Permission granted to use for any
@@ -70,6 +71,8 @@ extern "C" {
 
 #ifndef _POSIX_SOURCE
 
+#include <sys/cdefs.h>
+
 void _farpokeb(unsigned short, unsigned long, unsigned char);
 void _farpokew(unsigned short, unsigned long, unsigned short);
 void _farpokel(unsigned short, unsigned long, unsigned long);
@@ -85,7 +88,7 @@ unsigned char _farnspeekb(unsigned long)
 unsigned short _farnspeekw(unsigned long);
 unsigned long _farnspeekl(unsigned long);
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farpokeb(unsigned short selector,
 	 unsigned long offset,
 	 unsigned char value)
@@ -97,7 +100,7 @@ _farpokeb(unsigned short selector,
       : "rm" (selector), "qi" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farpokew(unsigned short selector,
 	 unsigned long offset,
 	 unsigned short value)
@@ -109,7 +112,7 @@ _farpokew(unsigned short selector,
       : "rm" (selector), "ri" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farpokel(unsigned short selector,
 	 unsigned long offset,
 	 unsigned long value)
@@ -121,7 +124,7 @@ _farpokel(unsigned short selector,
       : "rm" (selector), "ri" (value), "r" (offset));
 }
 
-extern __inline__ unsigned char
+_EXTERN_INLINE unsigned char
 _farpeekb(unsigned short selector,
 	 unsigned long offset)
 {
@@ -134,7 +137,7 @@ _farpeekb(unsigned short selector,
   return result;
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 _farpeekw(unsigned short selector,
 	 unsigned long offset)
 {
@@ -147,7 +150,7 @@ _farpeekw(unsigned short selector,
   return result;
 }
 
-extern __inline__ unsigned long
+_EXTERN_INLINE unsigned long
 _farpeekl(unsigned short selector,
 	 unsigned long offset)
 {
@@ -160,7 +163,7 @@ _farpeekl(unsigned short selector,
   return result;
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farsetsel(unsigned short selector)
 {
   __asm__ __volatile__ ("movw %w0,%%gs"
@@ -168,7 +171,7 @@ _farsetsel(unsigned short selector)
       : "rm" (selector));
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 _fargetsel(void)
 {
   unsigned short selector;
@@ -178,7 +181,7 @@ _fargetsel(void)
   return selector;
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farnspokeb(unsigned long offset,
 	 unsigned char value)
 {
@@ -188,7 +191,7 @@ _farnspokeb(unsigned long offset,
       : "qi" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farnspokew(unsigned long offset,
 	 unsigned short value)
 {
@@ -198,7 +201,7 @@ _farnspokew(unsigned long offset,
       : "ri" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farnspokel(unsigned long offset,
 	 unsigned long value)
 {
@@ -208,7 +211,7 @@ _farnspokel(unsigned long offset,
       : "ri" (value), "r" (offset));
 }
 
-extern __inline__ unsigned char
+_EXTERN_INLINE unsigned char
 _farnspeekb(unsigned long offset)
 {
   unsigned char result;
@@ -219,7 +222,7 @@ _farnspeekb(unsigned long offset)
   return result;
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 _farnspeekw(unsigned long offset)
 {
   unsigned short result;
@@ -230,7 +233,7 @@ _farnspeekw(unsigned long offset)
   return result;
 }
 
-extern __inline__ unsigned long
+_EXTERN_INLINE unsigned long
 _farnspeekl(unsigned long offset)
 {
   unsigned long result;
diff -aprNU3 djgpp.orig/include/netinet/in.h djgpp/include/netinet/in.h
--- djgpp.orig/include/netinet/in.h	2003-02-04 20:25:20 +0000
+++ djgpp/include/netinet/in.h	2011-01-05 23:29:06 +0000
@@ -1,3 +1,4 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
@@ -29,15 +30,16 @@ unsigned short ntohs(unsigned short _val
 #endif /* !__dj_ENFORCE_ANSI_FREESTANDING */
 
 #ifndef __dj_ENFORCE_FUNCTION_CALLS
+#include <sys/cdefs.h>
 
-extern __inline__ unsigned long
+_EXTERN_INLINE unsigned long
 htonl(unsigned long _val)
 {
   return (_val << 24) | ((_val&0xff00) << 8) | ((_val&0xff0000) >> 8) | (_val >> 24);
 }
 #define ntohl(x) htonl(x)
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 htons(unsigned short _val)
 {
   return (_val << 8) | (_val >> 8);
diff -aprNU3 djgpp.orig/include/sys/cdefs.h djgpp/include/sys/cdefs.h
--- djgpp.orig/include/sys/cdefs.h	2003-10-30 20:45:06 +0000
+++ djgpp/include/sys/cdefs.h	2011-01-05 23:29:06 +0000
@@ -1,6 +1,10 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1998 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1994 DJ Delorie, see COPYING.DJ for details */
+#ifndef __dj_include_sys_cdefs_h_
+#define __dj_include_sys_cdefs_h_
+
 #undef __P
 #if defined(__STDC__) || defined(__cplusplus)
 #define __P(p) p
@@ -30,6 +34,15 @@
 
 #define _ATTRIBUTE(attrs) __attribute__ ((attrs))
 
+
+/* Ensure that always traditional GNU extern inline semantics are used
+   (aka -fgnu89-inline) even if ISO C99 semantics have been specified.  */
+#if __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 2)
+# define _EXTERN_INLINE  extern __inline__ __attribute__ ((__gnu_inline__))
+#else
+# define _EXTERN_INLINE  extern __inline__
+#endif
+
 #if defined(__cplusplus)
 #define __BEGIN_DECLS	extern "C" {
 #define __END_DECLS	}
@@ -37,3 +50,5 @@
 #define __BEGIN_DECLS
 #define __END_DECLS
 #endif
+
+#endif /* !__dj_include_sys_cdefs_h_ */
diff -aprNU3 djgpp.orig/include/sys/farptr.h djgpp/include/sys/farptr.h
--- djgpp.orig/include/sys/farptr.h	2003-02-04 20:25:24 +0000
+++ djgpp/include/sys/farptr.h	2011-01-05 23:29:06 +0000
@@ -1,3 +1,4 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (c) 1995 DJ Delorie.  Permission granted to use for any
@@ -68,6 +69,8 @@ extern "C" {
 
 #ifndef _POSIX_SOURCE
 
+#include <sys/cdefs.h>
+
 void _farpokeb(unsigned short, unsigned long, unsigned char);
 void _farpokew(unsigned short, unsigned long, unsigned short);
 void _farpokel(unsigned short, unsigned long, unsigned long);
@@ -83,7 +86,7 @@ unsigned char _farnspeekb(unsigned long)
 unsigned short _farnspeekw(unsigned long);
 unsigned long _farnspeekl(unsigned long);
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farpokeb(unsigned short selector,
 	 unsigned long offset,
 	 unsigned char value)
@@ -95,7 +98,7 @@ _farpokeb(unsigned short selector,
       : "rm" (selector), "qi" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farpokew(unsigned short selector,
 	 unsigned long offset,
 	 unsigned short value)
@@ -107,7 +110,7 @@ _farpokew(unsigned short selector,
       : "rm" (selector), "ri" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farpokel(unsigned short selector,
 	 unsigned long offset,
 	 unsigned long value)
@@ -119,7 +122,7 @@ _farpokel(unsigned short selector,
       : "rm" (selector), "ri" (value), "r" (offset));
 }
 
-extern __inline__ unsigned char
+_EXTERN_INLINE unsigned char
 _farpeekb(unsigned short selector,
 	 unsigned long offset)
 {
@@ -132,7 +135,7 @@ _farpeekb(unsigned short selector,
   return result;
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 _farpeekw(unsigned short selector,
 	 unsigned long offset)
 {
@@ -145,7 +148,7 @@ _farpeekw(unsigned short selector,
   return result;
 }
 
-extern __inline__ unsigned long
+_EXTERN_INLINE unsigned long
 _farpeekl(unsigned short selector,
 	 unsigned long offset)
 {
@@ -158,7 +161,7 @@ _farpeekl(unsigned short selector,
   return result;
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farsetsel(unsigned short selector)
 {
   __asm__ __volatile__ ("movw %w0,%%fs"
@@ -166,7 +169,7 @@ _farsetsel(unsigned short selector)
       : "rm" (selector));
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 _fargetsel(void)
 {
   unsigned short selector;
@@ -176,7 +179,7 @@ _fargetsel(void)
   return selector;
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farnspokeb(unsigned long offset,
 	 unsigned char value)
 {
@@ -186,7 +189,7 @@ _farnspokeb(unsigned long offset,
       : "qi" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farnspokew(unsigned long offset,
 	 unsigned short value)
 {
@@ -196,7 +199,7 @@ _farnspokew(unsigned long offset,
       : "ri" (value), "r" (offset));
 }
 
-extern __inline__ void
+_EXTERN_INLINE void
 _farnspokel(unsigned long offset,
 	 unsigned long value)
 {
@@ -206,7 +209,7 @@ _farnspokel(unsigned long offset,
       : "ri" (value), "r" (offset));
 }
 
-extern __inline__ unsigned char
+_EXTERN_INLINE unsigned char
 _farnspeekb(unsigned long offset)
 {
   unsigned char result;
@@ -217,7 +220,7 @@ _farnspeekb(unsigned long offset)
   return result;
 }
 
-extern __inline__ unsigned short
+_EXTERN_INLINE unsigned short
 _farnspeekw(unsigned long offset)
 {
   unsigned short result;
@@ -228,7 +231,7 @@ _farnspeekw(unsigned long offset)
   return result;
 }
 
-extern __inline__ unsigned long
+_EXTERN_INLINE unsigned long
 _farnspeekl(unsigned long offset)
 {
   unsigned long result;
diff -aprNU3 djgpp.orig/include/time.h djgpp/include/time.h
--- djgpp.orig/include/time.h	2009-08-01 04:56:16 +0000
+++ djgpp/include/time.h	2011-01-05 23:29:06 +0000
@@ -1,3 +1,4 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2000 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1999 DJ Delorie, see COPYING.DJ for details */
@@ -110,9 +111,11 @@ int		settimeofday(struct timeval *_tp, .
 void		tzsetwall(void);
 uclock_t	uclock(void);
 
-static unsigned long long _rdtsc(void);
+#include <sys/cdefs.h>
 
-static __inline__ unsigned long long
+unsigned long long _rdtsc(void);
+
+_EXTERN_INLINE unsigned long long
 _rdtsc(void)
 {
   unsigned long long result;
diff -aprNU3 djgpp.orig/src/libc/pc_hw/farptr/farptr.c djgpp/src/libc/pc_hw/farptr/farptr.c
--- djgpp.orig/src/libc/pc_hw/farptr/farptr.c	1995-08-23 05:55:20 +0000
+++ djgpp/src/libc/pc_hw/farptr/farptr.c	2011-01-05 23:29:06 +0000
@@ -1,4 +1,5 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 1995 DJ Delorie, see COPYING.DJ for details */
-#define extern
-#define __inline__
+#define __dj_include_sys_cdefs_h_  /* Do not include sys/cdefs.h.  It provides the _EXTERN_INLINE definition.  */
+#define _EXTERN_INLINE
 #include <sys/farptr.h>
diff -aprNU3 djgpp.orig/src/libc/pc_hw/timer/rdtsc.c djgpp/src/libc/pc_hw/timer/rdtsc.c
--- djgpp.orig/src/libc/pc_hw/timer/rdtsc.c	2003-02-16 04:00:36 +0000
+++ djgpp/src/libc/pc_hw/timer/rdtsc.c	2011-01-05 23:29:06 +0000
@@ -1,4 +1,5 @@
+/* Copyright (C) 2011 DJ Delorie, see COPYING.DJ for details */
 /* Copyright (C) 2003 DJ Delorie, see COPYING.DJ for details */
-#define extern
-#define __inline__
+#define __dj_include_sys_cdefs_h_  /* Do not include sys/cdefs.h.  It provides the _EXTERN_INLINE definition.  */
+#define _EXTERN_INLINE
 #include <time.h>

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019