summaryrefslogtreecommitdiffstats
path: root/sys/alpha/include
diff options
context:
space:
mode:
authorjoerg <joerg@FreeBSD.org>2005-03-02 21:33:29 +0000
committerjoerg <joerg@FreeBSD.org>2005-03-02 21:33:29 +0000
commitc85a3e95f78bb183ec62ae6ef948265e7ade6b7a (patch)
tree69c98a86a28838e983d8eca9ba158f46450df8c1 /sys/alpha/include
parent2307c11d0fa1ac2133cff99d6c1a90c711b15f61 (diff)
downloadFreeBSD-src-c85a3e95f78bb183ec62ae6ef948265e7ade6b7a.zip
FreeBSD-src-c85a3e95f78bb183ec62ae6ef948265e7ade6b7a.tar.gz
netchild's mega-patch to isolate compiler dependencies into a central
place. This moves the dependency on GCC's and other compiler's features into the central sys/cdefs.h file, while the individual source files can then refer to #ifdef __COMPILER_FEATURE_FOO where they by now used to refer to #if __GNUC__ > 3.1415 && __BARC__ <= 42. By now, GCC and ICC (the Intel compiler) have been actively tested on IA32 platforms by netchild. Extension to other compilers is supposed to be possible, of course. Submitted by: netchild Reviewed by: various developers on arch@, some time ago
Diffstat (limited to 'sys/alpha/include')
-rw-r--r--sys/alpha/include/_types.h11
-rw-r--r--sys/alpha/include/atomic.h28
-rw-r--r--sys/alpha/include/cpufunc.h6
-rw-r--r--sys/alpha/include/critical.h6
-rw-r--r--sys/alpha/include/endian.h6
-rw-r--r--sys/alpha/include/in_cksum.h2
-rw-r--r--sys/alpha/include/ioctl_bt848.h4
-rw-r--r--sys/alpha/include/ioctl_meteor.h4
-rw-r--r--sys/alpha/include/limits.h4
-rw-r--r--sys/alpha/include/stdarg.h6
-rw-r--r--sys/alpha/include/varargs.h16
11 files changed, 57 insertions, 36 deletions
diff --git a/sys/alpha/include/_types.h b/sys/alpha/include/_types.h
index 885b241..a8acbbb 100644
--- a/sys/alpha/include/_types.h
+++ b/sys/alpha/include/_types.h
@@ -39,6 +39,10 @@
#ifndef _MACHINE__TYPES_H_
#define _MACHINE__TYPES_H_
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
/*
* Basic types upon which most other types are built.
*/
@@ -97,7 +101,7 @@ typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
-#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
+#ifdef __GNUCLIKE_BUILTIN_VAALIST
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef struct {
@@ -105,8 +109,9 @@ typedef struct {
int __offset;
int __pad;
} __va_list;
-#endif /* post GCC 2.95 */
-#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
+#endif /* __GNUCLIKE_BUILTIN_VAALIST */
+#if defined(__GNUC_VA_LIST_COMPATIBILITY) && !defined(__GNUC_VA_LIST) \
+ && !defined(__NO_GNUC_VA_LIST)
#define __GNUC_VA_LIST
typedef __va_list __gnuc_va_list; /* compatibility w/GNU headers*/
#endif
diff --git a/sys/alpha/include/atomic.h b/sys/alpha/include/atomic.h
index 599700b..cc2dbb4 100644
--- a/sys/alpha/include/atomic.h
+++ b/sys/alpha/include/atomic.h
@@ -29,6 +29,10 @@
#ifndef _MACHINE_ATOMIC_H_
#define _MACHINE_ATOMIC_H_
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
#include <machine/alpha_cpu.h>
/*
@@ -50,7 +54,7 @@ static __inline void atomic_set_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %2\n\t" /* load old value */
"bis %0, %3, %0\n\t" /* calculate new value */
@@ -66,7 +70,7 @@ static __inline void atomic_clear_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"bic %0, %2, %0\n\t" /* calculate new value */
@@ -82,7 +86,7 @@ static __inline void atomic_add_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"addl %0, %2, %0\n\t" /* calculate new value */
@@ -98,7 +102,7 @@ static __inline void atomic_subtract_32(volatile u_int32_t *p, u_int32_t v)
{
u_int32_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"subl %0, %2, %0\n\t" /* calculate new value */
@@ -114,7 +118,7 @@ static __inline u_int32_t atomic_readandclear_32(volatile u_int32_t *addr)
{
u_int32_t result,temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"wmb\n" /* ensure pending writes have drained */
"1:\tldl_l %0,%2\n\t" /* load current value, asserting lock */
@@ -133,7 +137,7 @@ static __inline void atomic_set_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"bis %0, %2, %0\n\t" /* calculate new value */
@@ -149,7 +153,7 @@ static __inline void atomic_clear_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"bic %0, %2, %0\n\t" /* calculate new value */
@@ -165,7 +169,7 @@ static __inline void atomic_add_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"addq %0, %2, %0\n\t" /* calculate new value */
@@ -181,7 +185,7 @@ static __inline void atomic_subtract_64(volatile u_int64_t *p, u_int64_t v)
{
u_int64_t temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"subq %0, %2, %0\n\t" /* calculate new value */
@@ -197,7 +201,7 @@ static __inline u_int64_t atomic_readandclear_64(volatile u_int64_t *addr)
{
u_int64_t result,temp;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"wmb\n" /* ensure pending writes have drained */
"1:\tldq_l %0,%2\n\t" /* load current value, asserting lock */
@@ -336,7 +340,7 @@ atomic_cmpset_32(volatile u_int32_t* p, u_int32_t cmpval, u_int32_t newval)
{
u_int32_t ret;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldl_l %0, %1\n\t" /* load old value */
"cmpeq %0, %2, %0\n\t" /* compare */
@@ -363,7 +367,7 @@ atomic_cmpset_64(volatile u_int64_t* p, u_int64_t cmpval, u_int64_t newval)
{
u_int64_t ret;
-#ifdef __GNUC__
+#ifdef __GNUCLIKE_ASM
__asm __volatile (
"1:\tldq_l %0, %1\n\t" /* load old value */
"cmpeq %0, %2, %0\n\t" /* compare */
diff --git a/sys/alpha/include/cpufunc.h b/sys/alpha/include/cpufunc.h
index 05bdbd4..5979987 100644
--- a/sys/alpha/include/cpufunc.h
+++ b/sys/alpha/include/cpufunc.h
@@ -35,9 +35,13 @@
#include <machine/chipset.h>
#include <machine/alpha_cpu.h>
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
struct thread;
-#ifdef __GNUC__
+#if defined(__GNUCLIKE_ASM)
static __inline void
breakpoint(void)
diff --git a/sys/alpha/include/critical.h b/sys/alpha/include/critical.h
index 22ff08c..4c9f729 100644
--- a/sys/alpha/include/critical.h
+++ b/sys/alpha/include/critical.h
@@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
-#ifdef __GNUC__
+#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@@ -75,12 +75,12 @@ cpu_critical_exit(struct thread *td)
intr_restore(td->td_md.md_savecrit);
}
-#else /* !__GNUC__ */
+#else /* !__CC_SUPPORTS___INLINE */
void cpu_critical_enter(struct thread *td);
void cpu_critical_exit(struct thread *td);
-#endif /* __GNUC__ */
+#endif /* __CC_SUPPORTS___INLINE */
__END_DECLS
diff --git a/sys/alpha/include/endian.h b/sys/alpha/include/endian.h
index 1b11ffb..974ce16 100644
--- a/sys/alpha/include/endian.h
+++ b/sys/alpha/include/endian.h
@@ -64,7 +64,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
-#ifdef __GNUC__
+#if defined(__CC_SUPPORTS___INLINE) && defined(__GNUCLIKE_ASM)
static __inline __uint64_t
__bswap64(__uint64_t _x)
@@ -113,7 +113,7 @@ __bswap16(__uint16_t _x)
#define __ntohl(x) __bswap32(x)
#define __ntohs(x) __bswap16(x)
-#else /* !__GNUC__ */
+#else /* !(__CC_SUPPORTS___INLINE && __GNUCLIKE_ASM) */
/*
* No optimizations are available for this compiler. Fall back to
@@ -122,6 +122,6 @@ __bswap16(__uint16_t _x)
*/
#define _BYTEORDER_FUNC_DEFINED
-#endif /* __GNUC__ */
+#endif /* __CC_SUPPORTS___INLINE && __GNUCLIKE_ASM */
#endif /* !_MACHINE_ENDIAN_H_ */
diff --git a/sys/alpha/include/in_cksum.h b/sys/alpha/include/in_cksum.h
index a899ef0..0992006 100644
--- a/sys/alpha/include/in_cksum.h
+++ b/sys/alpha/include/in_cksum.h
@@ -45,7 +45,7 @@
* in the normal case (where there are no options and the header length is
* therefore always exactly five 32-bit words.
*/
-#ifdef __GNUC__
+#ifdef __CC_SUPPORTS___INLINE
static __inline void
in_cksum_update(struct ip *ip)
diff --git a/sys/alpha/include/ioctl_bt848.h b/sys/alpha/include/ioctl_bt848.h
index 7ef237b..ca83a36 100644
--- a/sys/alpha/include/ioctl_bt848.h
+++ b/sys/alpha/include/ioctl_bt848.h
@@ -29,7 +29,9 @@
#ifndef _MACHINE_IOCTL_BT848_H_
#define _MACHINE_IOCTL_BT848_H_
-#ifdef __GNUC__
+#include <sys/cdefs.h>
+
+#ifdef __CC_SUPPORTS_WARNING
#warning Include dev/bktr/ioctl_bt848.h instead of this header.
#endif
diff --git a/sys/alpha/include/ioctl_meteor.h b/sys/alpha/include/ioctl_meteor.h
index 69d033e..0322f1e 100644
--- a/sys/alpha/include/ioctl_meteor.h
+++ b/sys/alpha/include/ioctl_meteor.h
@@ -29,7 +29,9 @@
#ifndef _MACHINE_IOCTL_METEOR_H_
#define _MACHINE_IOCTL_METEOR_H_
-#ifdef __GNUC__
+#include <sys/cdefs.h>
+
+#ifdef __CC_SUPPORTS_WARNING
#warning Include dev/bktr/ioctl_meteor.h instead of this header.
#endif
diff --git a/sys/alpha/include/limits.h b/sys/alpha/include/limits.h
index a02c8e1..9444760 100644
--- a/sys/alpha/include/limits.h
+++ b/sys/alpha/include/limits.h
@@ -34,7 +34,9 @@
#ifndef _MACHINE_LIMITS_H_
#define _MACHINE_LIMITS_H_
-#if __GNUC__
+#include <sys/cdefs.h>
+
+#ifdef __CC_SUPPORTS_WARNING
#warning "machine/limits.h is deprecated. Include sys/limits.h instead."
#endif
diff --git a/sys/alpha/include/stdarg.h b/sys/alpha/include/stdarg.h
index bd67f1f..1344962 100644
--- a/sys/alpha/include/stdarg.h
+++ b/sys/alpha/include/stdarg.h
@@ -47,7 +47,7 @@
typedef __va_list va_list;
#endif
-#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
+#ifdef __GNUCLIKE_BUILTIN_STDARG
#define va_start(ap, last) \
__builtin_stdarg_start((ap), (last))
@@ -63,7 +63,7 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
-#else /* ! __GNUC__ post GCC 2.95 */
+#else /* !__GNUCLIKE_BUILTIN_STDARG */
#ifdef __lint__
#define __builtin_saveregs() (0)
@@ -87,6 +87,6 @@ typedef __va_list va_list;
#define va_end(ap) ((void)0)
-#endif /* __GNUC__ post GCC 2.95 */
+#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */
diff --git a/sys/alpha/include/varargs.h b/sys/alpha/include/varargs.h
index 8565a3c..b05a9a5 100644
--- a/sys/alpha/include/varargs.h
+++ b/sys/alpha/include/varargs.h
@@ -44,7 +44,11 @@
#ifndef _MACHINE_VARARGS_H_
#define _MACHINE_VARARGS_H_
-#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
+#ifndef _SYS_CDEFS_H_
+#error this file needs sys/cdefs.h as a prerequisite
+#endif
+
+#if defined(__GNUCLIKE_BUILTIN_VARARGS)
#include <sys/_types.h>
@@ -61,23 +65,21 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_arg(ap, type) __builtin_va_arg((ap), type)
#define va_end(ap) __builtin_va_end(ap)
-#else /* ! __GNUC__ post GCC 2.95 */
+#else /* ! __GNUCLIKE_BUILTIN_VARARGS */
#include <machine/stdarg.h>
-#if __GNUC__ == 1
-#define __va_ellipsis
-#else
#define __va_ellipsis ...
-#endif
+#ifdef __GNUCLIKE_BUILTIN_VAALIST
#define va_alist __builtin_va_alist
#define va_dcl long __builtin_va_alist; __va_ellipsis
+#endif
#undef va_start
#define va_start(ap) \
((ap) = *(va_list *)__builtin_saveregs(), (ap).__pad = 0)
-#endif /* __GNUC__ post GCC 2.95 */
+#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE_VARARGS_H_ */
OpenPOWER on IntegriCloud