summaryrefslogtreecommitdiffstats
path: root/sys/sparc64
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/sparc64
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/sparc64')
-rw-r--r--sys/sparc64/include/_types.h11
-rw-r--r--sys/sparc64/include/critical.h6
-rw-r--r--sys/sparc64/include/endian.h2
-rw-r--r--sys/sparc64/include/stdarg.h10
-rw-r--r--sys/sparc64/include/varargs.h14
5 files changed, 26 insertions, 17 deletions
diff --git a/sys/sparc64/include/_types.h b/sys/sparc64/include/_types.h
index f014b54..f810c15 100644
--- a/sys/sparc64/include/_types.h
+++ b/sys/sparc64/include/_types.h
@@ -35,6 +35,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.
*/
@@ -93,12 +97,13 @@ typedef __uint64_t __vm_size_t;
/*
* Unusual type definitions.
*/
-#if defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3)
+#ifdef __GNUCLIKE_BUILTIN_VARARGS
typedef __builtin_va_list __va_list; /* internally known to gcc */
#else
typedef char * __va_list;
-#endif /* post GCC 2.95 */
-#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST)
+#endif /* __GNUCLIKE_BUILTIN_VARARGS */
+#if defined(__GNUCLIKE_BUILTIN_VAALIST) && !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/sparc64/include/critical.h b/sys/sparc64/include/critical.h
index 381ec45..999a5fd 100644
--- a/sys/sparc64/include/critical.h
+++ b/sys/sparc64/include/critical.h
@@ -46,7 +46,7 @@ __BEGIN_DECLS
*/
void cpu_critical_fork_exit(void);
-#ifdef __GNUC__
+#ifdef __CC_SUPPORTS___INLINE
/*
* cpu_critical_enter:
@@ -79,12 +79,12 @@ cpu_critical_exit(struct thread *td)
wrpr(pil, td->td_md.md_savecrit, 0);
}
-#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/sparc64/include/endian.h b/sys/sparc64/include/endian.h
index a3b9c2d..a643dd3 100644
--- a/sys/sparc64/include/endian.h
+++ b/sys/sparc64/include/endian.h
@@ -63,7 +63,7 @@
#define BYTE_ORDER _BYTE_ORDER
#endif
-#if defined(__GNUC__) && defined(__OPTIMIZE__)
+#if defined(__GNUCLIKE_BUILTIN_CONSTANT_P) && defined(__OPTIMIZE__)
#define __is_constant(x) __builtin_constant_p(x)
#else
#define __is_constant(x) 0
diff --git a/sys/sparc64/include/stdarg.h b/sys/sparc64/include/stdarg.h
index bd4e9dd..a7ff284 100644
--- a/sys/sparc64/include/stdarg.h
+++ b/sys/sparc64/include/stdarg.h
@@ -49,7 +49,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))
@@ -65,7 +65,11 @@ typedef __va_list va_list;
#define va_end(ap) \
__builtin_va_end(ap)
-#else /* ! __GNUC__ post GCC 2.95 */
+#else /* ! __GNUCLIKE_BUILTIN_STDARG */
+
+#if !defined(__GNUCLIKE_BUILTIN_NEXT_ARG) && !defined(lint)
+#error no support for your compiler
+#endif
#define va_start(ap, last) \
(__builtin_next_arg(last), (ap) = (va_list)__builtin_saveregs())
@@ -92,6 +96,6 @@ typedef __va_list va_list;
(sizeof(type) <= 16 ? __va_arg16(ap, type) : \
*__va_arg8(ap, type *)))))
-#endif /* __GNUC__ post GCC 2.95 */
+#endif /* __GNUCLIKE_BUILTIN_STDARG */
#endif /* !_MACHINE_STDARG_H_ */
diff --git a/sys/sparc64/include/varargs.h b/sys/sparc64/include/varargs.h
index 165e807..a168c6e 100644
--- a/sys/sparc64/include/varargs.h
+++ b/sys/sparc64/include/varargs.h
@@ -52,7 +52,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
+
+#ifdef __GNUCLIKE_BUILTIN_VARARGS
#include <sys/_types.h>
@@ -69,15 +73,11 @@ 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
#define va_alist __builtin_va_alist
#define va_dcl long __builtin_va_alist; __va_ellipsis
@@ -86,6 +86,6 @@ typedef int __builtin_va_alist_t __attribute__((__mode__(__word__)));
#define va_start(ap) \
((ap) = (va_list)__builtin_saveregs())
-#endif /* __GNUC__ post GCC 2.95 */
+#endif /* __GNUCLIKE_BUILTIN_VARARGS */
#endif /* !_MACHINE_VARARGS_H_ */
OpenPOWER on IntegriCloud