diff options
author | joerg <joerg@FreeBSD.org> | 2005-03-02 21:33:29 +0000 |
---|---|---|
committer | joerg <joerg@FreeBSD.org> | 2005-03-02 21:33:29 +0000 |
commit | c85a3e95f78bb183ec62ae6ef948265e7ade6b7a (patch) | |
tree | 69c98a86a28838e983d8eca9ba158f46450df8c1 /sys/i386/include | |
parent | 2307c11d0fa1ac2133cff99d6c1a90c711b15f61 (diff) | |
download | FreeBSD-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/i386/include')
-rw-r--r-- | sys/i386/include/_types.h | 13 | ||||
-rw-r--r-- | sys/i386/include/atomic.h | 26 | ||||
-rw-r--r-- | sys/i386/include/bus_at386.h | 42 | ||||
-rw-r--r-- | sys/i386/include/cpufunc.h | 16 | ||||
-rw-r--r-- | sys/i386/include/critical.h | 6 | ||||
-rw-r--r-- | sys/i386/include/endian.h | 16 | ||||
-rw-r--r-- | sys/i386/include/ieeefp.h | 8 | ||||
-rw-r--r-- | sys/i386/include/in_cksum.h | 8 | ||||
-rw-r--r-- | sys/i386/include/ioctl_bt848.h | 4 | ||||
-rw-r--r-- | sys/i386/include/ioctl_meteor.h | 4 | ||||
-rw-r--r-- | sys/i386/include/limits.h | 4 | ||||
-rw-r--r-- | sys/i386/include/pcpu.h | 9 | ||||
-rw-r--r-- | sys/i386/include/profile.h | 16 | ||||
-rw-r--r-- | sys/i386/include/stdarg.h | 12 | ||||
-rw-r--r-- | sys/i386/include/varargs.h | 14 |
15 files changed, 116 insertions, 82 deletions
diff --git a/sys/i386/include/_types.h b/sys/i386/include/_types.h index 9884c83..7df734d 100644 --- a/sys/i386/include/_types.h +++ b/sys/i386/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. */ @@ -54,7 +58,7 @@ typedef unsigned int __uint32_t; typedef long long __int64_t; /* LONGLONG */ typedef unsigned long long __uint64_t; -#elif defined(__GNUC__) || defined(__INTEL_COMPILER) +#elif defined(__GNUCLIKE_ATTRIBUTE_MODE_DI) typedef int __attribute__((__mode__(__DI__))) __int64_t; typedef unsigned int __attribute__((__mode__(__DI__))) __uint64_t; #else @@ -114,12 +118,13 @@ typedef __uint32_t __vm_size_t; /* * Unusual type definitions. */ -#if (defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)) +#ifdef __GNUCLIKE_BUILTIN_VARARGS typedef __builtin_va_list __va_list; /* internally known to gcc */ #else typedef char * __va_list; -#endif /* ! (__GNUC__ post 2.95 || __INTEL_COMPILER) */ -#if defined(__GNUC__) && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) +#endif /* __GNUCLIKE_BUILTIN_VARARGS */ +#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/i386/include/atomic.h b/sys/i386/include/atomic.h index 5b9ef42..219a33b 100644 --- a/sys/i386/include/atomic.h +++ b/sys/i386/include/atomic.h @@ -28,6 +28,10 @@ #ifndef _MACHINE_ATOMIC_H_ #define _MACHINE_ATOMIC_H_ +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + /* * Various simple arithmetic on memory which is atomic in the presence * of interrupts and multiple processors. @@ -75,7 +79,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #else /* !KLD_MODULE */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM /* * For userland, assume the SMP case and use lock prefixes so that @@ -101,12 +105,12 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ } \ struct __hack -#else /* !(__GNUC__ || __INTEL_COMPILER) */ +#else /* !__GNUCLIKE_ASM */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __GNUCLIKE_ASM */ /* * Atomic compare and set, used by the mutex functions @@ -116,7 +120,7 @@ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) * Returns 0 on failure, non-zero on success */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM #if defined(CPU_DISABLE_CMPXCHG) @@ -168,9 +172,9 @@ atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) #endif /* defined(CPU_DISABLE_CMPXCHG) */ -#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ +#endif /* __GNUCLIKE_ASM */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM #if defined(_KERNEL) && !defined(SMP) @@ -226,7 +230,7 @@ struct __hack #endif /* !defined(SMP) */ -#else /* !(defined(__GNUC__) || defined(__INTEL_COMPILER)) */ +#else /* !__GNUCLIKE_ASM */ extern int atomic_cmpset_int(volatile u_int *, u_int, u_int); @@ -234,7 +238,7 @@ extern int atomic_cmpset_int(volatile u_int *, u_int, u_int); extern u_##TYPE atomic_load_acq_##TYPE(volatile u_##TYPE *p); \ extern void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) -#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ +#endif /* __GNUCLIKE_ASM */ #endif /* KLD_MODULE */ @@ -410,7 +414,7 @@ ATOMIC_PTR(subtract) #undef ATOMIC_PTR -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM static __inline u_int atomic_readandclear_int(volatile u_int *addr) @@ -442,12 +446,12 @@ atomic_readandclear_long(volatile u_long *addr) return (result); } -#else /* !(defined(__GNUC__) || defined(__INTEL_COMPILER)) */ +#else /* !__GNUCLIKE_ASM */ extern u_long atomic_readandclear_long(volatile u_long *); extern u_int atomic_readandclear_int(volatile u_int *); -#endif /* defined(__GNUC__) || defined(__INTEL_COMPILER) */ +#endif /* __GNUCLIKE_ASM */ #endif /* !defined(WANT_FUNCTIONS) */ #endif /* ! _MACHINE_ATOMIC_H_ */ diff --git a/sys/i386/include/bus_at386.h b/sys/i386/include/bus_at386.h index 4600e35..83302b9 100644 --- a/sys/i386/include/bus_at386.h +++ b/sys/i386/include/bus_at386.h @@ -72,6 +72,10 @@ #ifndef _I386_BUS_AT386_H_ #define _I386_BUS_AT386_H_ +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + #include <machine/cpufunc.h> /* @@ -292,7 +296,7 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: movb (%2),%%al \n\ @@ -325,7 +329,7 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: movw (%2),%%ax \n\ @@ -358,7 +362,7 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: movl (%2),%%eax \n\ @@ -411,7 +415,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: inb %w2,%%al \n\ @@ -434,7 +438,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -461,7 +465,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: inw %w2,%%ax \n\ @@ -484,7 +488,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -511,7 +515,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: inl %w2,%%eax \n\ @@ -534,7 +538,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -667,7 +671,7 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -700,7 +704,7 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -733,7 +737,7 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -787,7 +791,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -810,7 +814,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -837,7 +841,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -860,7 +864,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -887,7 +891,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -910,7 +914,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -1293,7 +1297,7 @@ static __inline void bus_space_barrier(bus_space_tag_t tag __unused, bus_space_handle_t bsh __unused, bus_size_t offset __unused, bus_size_t len __unused, int flags) { -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%esp)" : : : "memory"); else diff --git a/sys/i386/include/cpufunc.h b/sys/i386/include/cpufunc.h index 01f5c56..ecb84cd 100644 --- a/sys/i386/include/cpufunc.h +++ b/sys/i386/include/cpufunc.h @@ -38,6 +38,10 @@ #ifndef _MACHINE_CPUFUNC_H_ #define _MACHINE_CPUFUNC_H_ +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + struct region_descriptor; #define readb(va) (*(volatile u_int8_t *) (va)) @@ -48,7 +52,7 @@ struct region_descriptor; #define writew(va, d) (*(volatile u_int16_t *) (va) = (d)) #define writel(va, d) (*(volatile u_int32_t *) (va) = (d)) -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) static __inline void breakpoint(void) @@ -126,12 +130,12 @@ halt(void) __asm __volatile("hlt"); } -#if __GNUC__ < 2 +#if !defined(__GNUCLIKE_BUILTIN_CONSTANT_P) || __GNUCLIKE_ASM < 3 #define inb(port) inbv(port) #define outb(port, data) outbv(port, data) -#else /* __GNUC >= 2 */ +#else /* __GNUCLIKE_BUILTIN_CONSTANT_P && __GNUCLIKE_ASM >= 3 */ /* * The following complications are to get around gcc not having a @@ -178,7 +182,7 @@ outbc(u_int port, u_char data) __asm __volatile("outb %0,%1" : : "a" (data), "id" ((u_short)(port))); } -#endif /* __GNUC <= 2 */ +#endif /* __GNUCLIKE_BUILTIN_CONSTANT_P && __GNUCLIKE_ASM >= 3*/ static __inline u_char inbv(u_int port) @@ -618,7 +622,7 @@ intr_restore(register_t eflags) write_eflags(eflags); } -#else /* !(__GNUC__ || __INTEL_COMPILER) */ +#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ int breakpoint(void); u_int bsfl(u_int mask); @@ -683,7 +687,7 @@ void wbinvd(void); void write_eflags(u_int ef); void wrmsr(u_int msr, u_int64_t newval); -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ void reset_dbregs(void); diff --git a/sys/i386/include/critical.h b/sys/i386/include/critical.h index 9826988..58af490 100644 --- a/sys/i386/include/critical.h +++ b/sys/i386/include/critical.h @@ -46,7 +46,7 @@ __BEGIN_DECLS */ void cpu_critical_fork_exit(void); -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __CC_SUPPORTS___INLINE /* * cpu_critical_enter: @@ -81,12 +81,12 @@ cpu_critical_exit(struct thread *td) intr_restore(td->td_md.md_savecrit); } -#else /* !(__GNUC__ || __INTEL_COMPILER) */ +#else /* !__CC_SUPPORTS___INLINE */ void cpu_critical_enter(struct thread *td); void cpu_critical_exit(struct thread *td); -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __CC_SUPPORTS___INLINE */ __END_DECLS diff --git a/sys/i386/include/endian.h b/sys/i386/include/endian.h index 13d596a..59fa4a5 100644 --- a/sys/i386/include/endian.h +++ b/sys/i386/include/endian.h @@ -67,17 +67,7 @@ extern "C" { #define BYTE_ORDER _BYTE_ORDER #endif -#if defined(__INTEL_COMPILER) -#if defined(__cplusplus) -#if __INTEL_COMPILER >= 800 -#define __INTEL_COMPILER_with_FreeBSD_endian 1 -#endif -#else -#define __INTEL_COMPILER_with_FreeBSD_endian 1 -#endif -#endif - -#if defined(__GNUC__) || defined(__INTEL_COMPILER_with_FreeBSD_endian) +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) #define __word_swap_int_var(x) \ __extension__ ({ register __uint32_t __X = (x); \ @@ -168,7 +158,7 @@ __bswap16(__uint16_t _x) #define __ntohl(x) __bswap32(x) #define __ntohs(x) __bswap16(x) -#else /* !(__GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian) */ +#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ /* * No optimizations are available for this compiler. Fall back to @@ -177,7 +167,7 @@ __bswap16(__uint16_t _x) */ #define _BYTEORDER_FUNC_DEFINED -#endif /* __GNUC__ || __INTEL_COMPILER_with_FreeBSD_endian */ +#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ #ifdef __cplusplus } diff --git a/sys/i386/include/ieeefp.h b/sys/i386/include/ieeefp.h index 48011f71..17dbc88 100644 --- a/sys/i386/include/ieeefp.h +++ b/sys/i386/include/ieeefp.h @@ -41,6 +41,10 @@ #ifndef _MACHINE_IEEEFP_H_ #define _MACHINE_IEEEFP_H_ +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + /* * FP rounding modes */ @@ -98,7 +102,7 @@ typedef enum { #define FP_RND_OFF 10 /* round control offset */ #define FP_STKY_OFF 0 /* sticky flags offset */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM #define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr))) #define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) @@ -151,7 +155,7 @@ __fpsetreg(int _m, int _reg, int _fld, int _off) return _p; } -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __GNUCLIKE_ASM */ /* * SysV/386 FP control interface diff --git a/sys/i386/include/in_cksum.h b/sys/i386/include/in_cksum.h index 27d1195..062c675 100644 --- a/sys/i386/include/in_cksum.h +++ b/sys/i386/include/in_cksum.h @@ -35,6 +35,10 @@ #ifndef _MACHINE_IN_CKSUM_H_ #define _MACHINE_IN_CKSUM_H_ 1 +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + /* * MP safe (alfred) */ @@ -49,7 +53,7 @@ * in the normal case (where there are no options and the header length is * therefore always exactly five 32-bit words. */ -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#if defined(__GNUCLIKE_ASM) && !defined(__INTEL_COMPILER) static __inline u_int in_cksum_hdr(const struct ip *ip) { @@ -119,7 +123,7 @@ in_pseudo(u_int sum, u_int b, u_int c) #endif #ifdef _KERNEL -#if !defined(__GNUC__) || defined(__INTEL_COMPILER) +#if !defined(__GNUCLIKE_ASM) || defined(__INTEL_COMPILER) u_int in_cksum_hdr(const struct ip *ip); u_short in_addword(u_short sum, u_short b); u_short in_pseudo(u_int sum, u_int b, u_int c); diff --git a/sys/i386/include/ioctl_bt848.h b/sys/i386/include/ioctl_bt848.h index c87c4b9..ca83a36 100644 --- a/sys/i386/include/ioctl_bt848.h +++ b/sys/i386/include/ioctl_bt848.h @@ -29,7 +29,9 @@ #ifndef _MACHINE_IOCTL_BT848_H_ #define _MACHINE_IOCTL_BT848_H_ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#include <sys/cdefs.h> + +#ifdef __CC_SUPPORTS_WARNING #warning Include dev/bktr/ioctl_bt848.h instead of this header. #endif diff --git a/sys/i386/include/ioctl_meteor.h b/sys/i386/include/ioctl_meteor.h index c9595de..0322f1e 100644 --- a/sys/i386/include/ioctl_meteor.h +++ b/sys/i386/include/ioctl_meteor.h @@ -29,7 +29,9 @@ #ifndef _MACHINE_IOCTL_METEOR_H_ #define _MACHINE_IOCTL_METEOR_H_ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#include <sys/cdefs.h> + +#ifdef __CC_SUPPORTS_WARNING #warning Include dev/bktr/ioctl_meteor.h instead of this header. #endif diff --git a/sys/i386/include/limits.h b/sys/i386/include/limits.h index 8e3bb11..35eea1f 100644 --- a/sys/i386/include/limits.h +++ b/sys/i386/include/limits.h @@ -33,7 +33,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/i386/include/pcpu.h b/sys/i386/include/pcpu.h index 6552ea9..f371e39 100644 --- a/sys/i386/include/pcpu.h +++ b/sys/i386/include/pcpu.h @@ -29,6 +29,10 @@ #ifndef _MACHINE_PCPU_H_ #define _MACHINE_PCPU_H_ +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + #ifdef _KERNEL #include <machine/segments.h> @@ -59,7 +63,8 @@ extern struct pcpu *pcpup; #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) -#elif defined(__GNUC__) || defined (__INTEL_COMPILER) +#elif defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE___TYPEOF) \ + && defined(__GNUCLIKE___OFFSETOF) /* * Evaluates to the byte offset of the per-cpu variable name. @@ -162,7 +167,7 @@ __curthread(void) #define curthread (__curthread()) #else -#error gcc or lint is required to use this file +#error this file needs to be ported to your compiler #endif #endif /* _KERNEL */ diff --git a/sys/i386/include/profile.h b/sys/i386/include/profile.h index 79dd308..06418eb 100644 --- a/sys/i386/include/profile.h +++ b/sys/i386/include/profile.h @@ -33,6 +33,10 @@ #ifndef _MACHINE_PROFILE_H_ #define _MACHINE_PROFILE_H_ +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + #ifdef _KERNEL /* @@ -53,7 +57,7 @@ #define MCOUNT_DECL(s) #define MCOUNT_ENTER(s) #define MCOUNT_EXIT(s) -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM #define MCOUNT_OVERHEAD(label) \ __asm __volatile("pushl %0; call __mcount; popl %%ecx" \ : \ @@ -71,7 +75,7 @@ #define MEXITCOUNT_OVERHEAD_GETLABEL() #else #error -#endif /* !(__GNUC__ || __INTEL_COMPILER) */ +#endif /* !__GNUCLIKE_ASM */ #else /* !GUPROF */ #define MCOUNT_DECL(s) u_long s; #ifdef SMP @@ -106,7 +110,7 @@ void user(void); #define _MCOUNT_DECL static __inline void _mcount -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM #define MCOUNT \ void \ mcount() \ @@ -129,13 +133,13 @@ mcount() \ frompc = ((uintfptr_t *)frompc)[1]; \ _mcount(frompc, selfpc); \ } -#else /* !(__GNUC__ || __INTEL_COMPILER) */ +#else /* !__GNUCLIKE_ASM */ void \ #define MCOUNT \ mcount() \ { \ } -#endif /* __GNUC__ || __INTEL_COMPILER */ +#endif /* __GNUCLIKE_ASM */ typedef u_int uintfptr_t; @@ -156,7 +160,7 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc); #include <sys/cdefs.h> __BEGIN_DECLS -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM void mcount(void) __asm(".mcount"); #endif __END_DECLS diff --git a/sys/i386/include/stdarg.h b/sys/i386/include/stdarg.h index ce59c7f..a8ef25e 100644 --- a/sys/i386/include/stdarg.h +++ b/sys/i386/include/stdarg.h @@ -46,7 +46,7 @@ typedef __va_list va_list; #endif -#if (defined(__GNUC__) && (__GNUC__ == 2 && __GNUC_MINOR__ > 95 || __GNUC__ >= 3) && !defined(__INTEL_COMPILER)) +#ifdef __GNUCLIKE_BUILTIN_STDARG #define va_start(ap, last) \ __builtin_stdarg_start((ap), (last)) @@ -62,18 +62,18 @@ typedef __va_list va_list; #define va_end(ap) \ __builtin_va_end(ap) -#else /* ! (__GNUC__ post GCC 2.95 || __INTEL_COMPILER) */ +#else /* !__GNUCLIKE_BUILTIN_STDARG */ #define __va_size(type) \ (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) -#if defined(__GNUC__) && !defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_BUILTIN_NEXT_ARG #define va_start(ap, last) \ ((ap) = (va_list)__builtin_next_arg(last)) -#else /* non-GNU compiler */ +#else /* !__GNUCLIKE_BUILTIN_NEXT_ARG */ #define va_start(ap, last) \ ((ap) = (va_list)&(last) + __va_size(last)) -#endif /* __GNUC__ */ +#endif /* __GNUCLIKE_BUILTIN_NEXT_ARG */ #define va_arg(ap, type) \ (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) @@ -85,6 +85,6 @@ typedef __va_list va_list; #define va_end(ap) -#endif /* __GNUC__ post GCC 2.95 */ +#endif /* __GNUCLIKE_BUILTIN_STDARG */ #endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/i386/include/varargs.h b/sys/i386/include/varargs.h index 4d05f87..a71b2ff 100644 --- a/sys/i386/include/varargs.h +++ b/sys/i386/include/varargs.h @@ -39,7 +39,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> @@ -56,17 +60,17 @@ 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 */ typedef char *va_list; #define __va_size(type) \ (((sizeof(type) + sizeof(int) - 1) / sizeof(int)) * sizeof(int)) -#ifdef __GNUC__ +#if defined(__GNUCLIKE_BUILTIN_VAALIST) #define va_alist __builtin_va_alist #endif -#if __GNUC__ > 1 +#ifdef __CC_SUPPORTS_VARADIC_XXX #define va_dcl int va_alist; ... #else #define va_dcl int va_alist; @@ -80,6 +84,6 @@ typedef char *va_list; #define va_end(ap) -#endif /* __GNUC__ post GCC 2.95 */ +#endif /* __GNUCLIKE_BUILTIN_VARARGS */ #endif /* !_MACHINE_VARARGS_H_ */ |