diff options
author | Joerg Wunsch <joerg@FreeBSD.org> | 2005-03-02 21:33:29 +0000 |
---|---|---|
committer | Joerg Wunsch <joerg@FreeBSD.org> | 2005-03-02 21:33:29 +0000 |
commit | a5f50ef9e43b28e15a7e2a2aec73754456619f17 (patch) | |
tree | 69c98a86a28838e983d8eca9ba158f46450df8c1 /sys/amd64 | |
parent | f685f62c9869f2c8181041ae3e3d87a09d2d3fbf (diff) |
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
Notes
Notes:
svn path=/head/; revision=143063
Diffstat (limited to 'sys/amd64')
-rw-r--r-- | sys/amd64/amd64/fpu.c | 6 | ||||
-rw-r--r-- | sys/amd64/amd64/prof_machdep.c | 24 | ||||
-rw-r--r-- | sys/amd64/include/_types.h | 9 | ||||
-rw-r--r-- | sys/amd64/include/atomic.h | 26 | ||||
-rw-r--r-- | sys/amd64/include/bus_amd64.h | 42 | ||||
-rw-r--r-- | sys/amd64/include/cpufunc.h | 16 | ||||
-rw-r--r-- | sys/amd64/include/critical.h | 6 | ||||
-rw-r--r-- | sys/amd64/include/endian.h | 6 | ||||
-rw-r--r-- | sys/amd64/include/ieeefp.h | 18 | ||||
-rw-r--r-- | sys/amd64/include/in_cksum.h | 2 | ||||
-rw-r--r-- | sys/amd64/include/limits.h | 4 | ||||
-rw-r--r-- | sys/amd64/include/pcpu.h | 9 | ||||
-rw-r--r-- | sys/amd64/include/profile.h | 18 | ||||
-rw-r--r-- | sys/amd64/include/stdarg.h | 4 | ||||
-rw-r--r-- | sys/amd64/include/varargs.h | 16 |
15 files changed, 122 insertions, 84 deletions
diff --git a/sys/amd64/amd64/fpu.c b/sys/amd64/amd64/fpu.c index 0b2071e11d9d..d727a4191d0e 100644 --- a/sys/amd64/amd64/fpu.c +++ b/sys/amd64/amd64/fpu.c @@ -63,7 +63,7 @@ __FBSDID("$FreeBSD$"); * Floating point support. */ -#if defined(__GNUC__) && !defined(lint) +#if defined(__GNUCLIKE_ASM) && !defined(lint) #define fldcw(addr) __asm("fldcw %0" : : "m" (*(addr))) #define fnclex() __asm("fnclex") @@ -77,7 +77,7 @@ __FBSDID("$FreeBSD$"); : : "n" (CR0_TS) : "ax") #define stop_emulating() __asm("clts") -#else /* not __GNUC__ */ +#else /* !__GNUCLIKE_ASM */ void fldcw(caddr_t addr); void fnclex(void); @@ -89,7 +89,7 @@ void fxrstor(caddr_t addr); void start_emulating(void); void stop_emulating(void); -#endif /* __GNUC__ */ +#endif /* __GNUCLIKE_ASM */ #define GET_FPU_CW(thread) ((thread)->td_pcb->pcb_save.sv_env.en_cw) #define GET_FPU_SW(thread) ((thread)->td_pcb->pcb_save.sv_env.en_sw) diff --git a/sys/amd64/amd64/prof_machdep.c b/sys/amd64/amd64/prof_machdep.c index e797cc080834..1449f3fffa91 100644 --- a/sys/amd64/amd64/prof_machdep.c +++ b/sys/amd64/amd64/prof_machdep.c @@ -69,7 +69,7 @@ static struct gmonparam saved_gmp; #endif #endif /* GUPROF */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm(" \n\ GM_STATE = 0 \n\ GMON_PROF_OFF = 3 \n\ @@ -140,9 +140,9 @@ __cyg_profile_func_enter: \n\ .mcount_exit: \n\ ret \n\ "); -#else /* !(__GNUC__ || __INTEL_COMPILER) */ -#error -#endif /* __GNUC__ || __INTEL_COMPILER */ +#else /* !__GNUCLIKE_ASM */ +#error this file needs to be ported to your compiler +#endif /* __GNUCLIKE_ASM */ #ifdef GUPROF /* @@ -151,7 +151,7 @@ __cyg_profile_func_enter: \n\ * dependent file together with cputime(), __mcount and [.]mcount. cputime() * can't just be put in machdep.c because it has to be compiled without -pg. */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm(" \n\ .text \n\ # \n\ @@ -194,9 +194,9 @@ __cyg_profile_func_exit: \n\ .mexitcount_exit: \n\ ret \n\ "); -#else /* !(__GNUC__ || __INTEL_COMPILER) */ -#error -#endif /* __GNUC__ || __INTEL_COMPILER */ +#else /* !__GNUCLIKE_ASM */ +#error this file needs to be ported to your compiler +#endif /* __GNUCLIKE_ASM */ /* * Return the time elapsed since the last call. The units are machine- @@ -379,7 +379,7 @@ stopguprof(gp) } #else /* !GUPROF */ -#if defined(__GNUC__) || defined(__INTEL_COMPILER) +#ifdef __GNUCLIKE_ASM __asm(" \n\ .text \n\ .p2align 4,0x90 \n\ @@ -387,7 +387,7 @@ __asm(" \n\ " __XSTRING(HIDENAME(mexitcount)) ": \n\ ret \n\ "); -#else /* !(__GNUC__ || __INTEL_COMPILER) */ -#error -#endif /* __GNUC__ || __INTEL_COMPILER */ +#else /* !__GNUCLIKE_ASM */ +#error this file needs to be ported to your compiler +#endif /* __GNUCLIKE_ASM */ #endif /* GUPROF */ diff --git a/sys/amd64/include/_types.h b/sys/amd64/include/_types.h index 4a7b6e7edcde..709cc161665f 100644 --- a/sys/amd64/include/_types.h +++ b/sys/amd64/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,12 +101,13 @@ typedef __uint64_t __vm_size_t; /* * Unusual type definitions. */ -#if defined(__GNUC__) +#ifdef __GNUCLIKE_BUILTIN_VARARGS typedef __builtin_va_list __va_list; /* internally known to gcc */ #elif defined(lint) typedef char * __va_list; /* pretend */ #endif -#if defined __GNUC__ && !defined(__GNUC_VA_LIST) && !defined(__NO_GNUC_VA_LIST) +#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/amd64/include/atomic.h b/sys/amd64/include/atomic.h index cbee2715929d..eaf8068c7f84 100644 --- a/sys/amd64/include/atomic.h +++ b/sys/amd64/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. @@ -76,7 +80,7 @@ void atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v) #else /* !KLD_MODULE */ -#ifdef __GNUC__ +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) /* * For userland, assume the SMP case and use lock prefixes so that @@ -102,12 +106,12 @@ atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ } \ struct __hack -#else /* !__GNUC__ */ +#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ #define ATOMIC_ASM(NAME, TYPE, OP, CONS, V) \ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) -#endif /* __GNUC__ */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ /* * Atomic compare and set, used by the mutex functions @@ -117,7 +121,7 @@ extern void atomic_##NAME##_##TYPE(volatile u_##TYPE *p, u_##TYPE v) * Returns 0 on failure, non-zero on success */ -#if defined(__GNUC__) +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) static __inline int atomic_cmpset_int(volatile u_int *dst, u_int exp, u_int src) @@ -158,9 +162,9 @@ atomic_cmpset_long(volatile u_long *dst, u_long exp, u_long src) return (res); } -#endif /* defined(__GNUC__) */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ -#if defined(__GNUC__) +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) #define ATOMIC_STORE_LOAD(TYPE, LOP, SOP) \ static __inline u_##TYPE \ @@ -189,7 +193,7 @@ atomic_store_rel_##TYPE(volatile u_##TYPE *p, u_##TYPE v)\ } \ struct __hack -#else /* !defined(__GNUC__) */ +#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ extern int atomic_cmpset_int(volatile u_int *, u_int, u_int); extern int atomic_cmpset_long(volatile u_long *, u_long, u_long); @@ -198,7 +202,7 @@ extern int atomic_cmpset_long(volatile u_long *, u_long, u_long); 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__) */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ #endif /* KLD_MODULE */ @@ -371,7 +375,7 @@ ATOMIC_PTR(subtract) #undef ATOMIC_PTR -#if defined(__GNUC__) +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) static __inline u_int atomic_readandclear_int(volatile u_int *addr) @@ -403,12 +407,12 @@ atomic_readandclear_long(volatile u_long *addr) return (result); } -#else /* !defined(__GNUC__) */ +#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ extern u_long atomic_readandclear_long(volatile u_long *); extern u_int atomic_readandclear_int(volatile u_int *); -#endif /* defined(__GNUC__) */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ #endif /* !defined(WANT_FUNCTIONS) */ #endif /* ! _MACHINE_ATOMIC_H_ */ diff --git a/sys/amd64/include/bus_amd64.h b/sys/amd64/include/bus_amd64.h index 189816bd0481..9e0bc45085af 100644 --- a/sys/amd64/include/bus_amd64.h +++ b/sys/amd64/include/bus_amd64.h @@ -74,6 +74,10 @@ #include <machine/cpufunc.h> +#ifndef _SYS_CDEFS_H_ +#error this file needs sys/cdefs.h as a prerequisite +#endif + /* * To remain compatible with NetBSD's interface, default to both memio and * pio when neither of them is defined. @@ -284,7 +288,7 @@ bus_space_read_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: movb (%2),%%al \n\ @@ -313,7 +317,7 @@ bus_space_read_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: movw (%2),%%ax \n\ @@ -342,7 +346,7 @@ bus_space_read_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: movl (%2),%%eax \n\ @@ -391,7 +395,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: inb %w2,%%al \n\ @@ -410,7 +414,7 @@ bus_space_read_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { bus_space_handle_t _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -433,7 +437,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: inw %w2,%%ax \n\ @@ -452,7 +456,7 @@ bus_space_read_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { bus_space_handle_t _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -475,7 +479,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: inl %w2,%%eax \n\ @@ -494,7 +498,7 @@ bus_space_read_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { bus_space_handle_t _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -623,7 +627,7 @@ bus_space_write_multi_1(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -652,7 +656,7 @@ bus_space_write_multi_2(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -681,7 +685,7 @@ bus_space_write_multi_4(bus_space_tag_t tag, bus_space_handle_t bsh, else #endif { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -731,7 +735,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsb \n\ @@ -750,7 +754,7 @@ bus_space_write_region_1(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { bus_space_handle_t _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -773,7 +777,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsw \n\ @@ -792,7 +796,7 @@ bus_space_write_region_2(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { bus_space_handle_t _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -815,7 +819,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { int _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ 1: lodsl \n\ @@ -834,7 +838,7 @@ bus_space_write_region_4(bus_space_tag_t tag, bus_space_handle_t bsh, #endif { bus_space_handle_t _port_ = bsh + offset; -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM __asm __volatile(" \n\ cld \n\ repne \n\ @@ -1213,7 +1217,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) { -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM if (flags & BUS_SPACE_BARRIER_READ) __asm __volatile("lock; addl $0,0(%%rsp)" : : : "memory"); else diff --git a/sys/amd64/include/cpufunc.h b/sys/amd64/include/cpufunc.h index e55885876204..4c596a02ebe1 100644 --- a/sys/amd64/include/cpufunc.h +++ b/sys/amd64/include/cpufunc.h @@ -39,6 +39,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)) @@ -51,7 +55,7 @@ struct region_descriptor; #define writel(va, d) (*(volatile u_int32_t *) (va) = (d)) #define writeq(va, d) (*(volatile u_int64_t *) (va) = (d)) -#ifdef __GNUC__ +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE) static __inline void breakpoint(void) @@ -152,12 +156,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 @@ -204,7 +208,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 */ static __inline u_char inbv(u_int port) @@ -696,7 +700,7 @@ intr_restore(register_t rflags) write_rflags(rflags); } -#else /* !__GNUC__ */ +#else /* !(__GNUCLIKE_ASM && __CC_SUPPORTS___INLINE) */ int breakpoint(void); u_int bsfl(u_int mask); @@ -761,7 +765,7 @@ void wbinvd(void); void write_rflags(u_int rf); void wrmsr(u_int msr, u_int64_t newval); -#endif /* __GNUC__ */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE */ void reset_dbregs(void); diff --git a/sys/amd64/include/critical.h b/sys/amd64/include/critical.h index 0e02e1fab640..37ba264b38d8 100644 --- a/sys/amd64/include/critical.h +++ b/sys/amd64/include/critical.h @@ -46,7 +46,7 @@ __BEGIN_DECLS */ void cpu_critical_fork_exit(void); -#ifdef __GNUC__ +#ifdef __CC_SUPPORTS___INLINE /* * cpu_critical_enter: @@ -74,12 +74,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/amd64/include/endian.h b/sys/amd64/include/endian.h index 459126bdac07..6ed21185fd7d 100644 --- a/sys/amd64/include/endian.h +++ b/sys/amd64/include/endian.h @@ -63,7 +63,7 @@ #define BYTE_ORDER _BYTE_ORDER #endif -#ifdef __GNUC__ +#if defined(__GNUCLIKE_ASM) && defined(__GNUCLIKE_BUILTIN_CONSTANT_P) #define __word_swap_int_var(x) \ __extension__ ({ register __uint32_t __X = (x); \ @@ -177,7 +177,7 @@ __bswap16(__uint16_t _x) #define __ntohl(x) __bswap32(x) #define __ntohs(x) __bswap16(x) -#else /* !__GNUC__ */ +#else /* !(__GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P) */ /* * No optimizations are available for this compiler. Fall back to @@ -186,6 +186,6 @@ __bswap16(__uint16_t _x) */ #define _BYTEORDER_FUNC_DEFINED -#endif /* __GNUC__ */ +#endif /* __GNUCLIKE_ASM && __GNUCLIKE_BUILTIN_CONSTANT_P */ #endif /* !_MACHINE_ENDIAN_H_ */ diff --git a/sys/amd64/include/ieeefp.h b/sys/amd64/include/ieeefp.h index 214f3b561671..bfa80aacff31 100644 --- a/sys/amd64/include/ieeefp.h +++ b/sys/amd64/include/ieeefp.h @@ -42,6 +42,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 */ @@ -117,7 +121,8 @@ typedef enum { #define SSE_RND_OFF 13 /* rounding control offset */ #define SSE_FZ_OFF 15 /* flush to zero offset */ -#if defined(__GNUC__) && !defined(__cplusplus) +#if defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__) \ + && !defined(__cplusplus) #define __fldenv(addr) __asm __volatile("fldenv %0" : : "m" (*(addr))) #define __fnstenv(addr) __asm __volatile("fnstenv %0" : "=m" (*(addr))) @@ -263,9 +268,10 @@ __fpsetsticky(fp_except_t _m) return (_p); } -#endif /* __GNUC__ && !__cplusplus */ +#endif /* __GNUCLIKE_ASM && __CC_SUPPORTS___INLINE__ && !__cplusplus */ -#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) && defined(__GNUC__) +#if !defined(__IEEEFP_NOINLINES__) && !defined(__cplusplus) \ + && defined(__GNUCLIKE_ASM) && defined(__CC_SUPPORTS___INLINE__) #define fpgetround() __fpgetround() #define fpsetround(_m) __fpsetround(_m) @@ -279,7 +285,8 @@ __fpsetsticky(fp_except_t _m) /* Suppress prototypes in the MI header. */ #define _IEEEFP_INLINED_ 1 -#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUC__ */ +#else /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM + && __CC_SUPPORTS___INLINE__ */ /* Augment the userland declarations */ __BEGIN_DECLS @@ -287,6 +294,7 @@ extern fp_prec_t fpgetprec(void); extern fp_prec_t fpsetprec(fp_prec_t); __END_DECLS -#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUC__ */ +#endif /* !__IEEEFP_NOINLINES__ && !__cplusplus && __GNUCLIKE_ASM + && __CC_SUPPORTS___INLINE__ */ #endif /* !_MACHINE_IEEEFP_H_ */ diff --git a/sys/amd64/include/in_cksum.h b/sys/amd64/include/in_cksum.h index a899ef0d8488..09920062a0ae 100644 --- a/sys/amd64/include/in_cksum.h +++ b/sys/amd64/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/amd64/include/limits.h b/sys/amd64/include/limits.h index 8e3bb11edfc3..35eea1f619de 100644 --- a/sys/amd64/include/limits.h +++ b/sys/amd64/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/amd64/include/pcpu.h b/sys/amd64/include/pcpu.h index 0694c766fc83..b9d4a6171911 100644 --- a/sys/amd64/include/pcpu.h +++ b/sys/amd64/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 /* @@ -55,7 +59,8 @@ extern struct pcpu *pcpup; #define PCPU_PTR(member) (&pcpup->pc_ ## member) #define PCPU_SET(member,value) (pcpup->pc_ ## member = (value)) -#elif defined(__GNUC__) +#elif defined(__GNUCLIKE___TYPEOF) && defined(__GNUCLIKE___OFFSETOF) \ + && defined(__GNUCLIKE_ASM) /* * Evaluates to the byte offset of the per-cpu variable name. @@ -170,7 +175,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/amd64/include/profile.h b/sys/amd64/include/profile.h index ecd34264dcd3..93e8614523f3 100644 --- a/sys/amd64/include/profile.h +++ b/sys/amd64/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) -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM #define MCOUNT_OVERHEAD(label) \ __asm __volatile("pushq %0; call __mcount; popq %%rcx" \ : \ @@ -70,8 +74,8 @@ #define MEXITCOUNT_OVERHEAD() #define MEXITCOUNT_OVERHEAD_GETLABEL() #else -#error -#endif /* __GNUC */ +#error this file needs to be ported to your compiler +#endif /* __GNUCLIKE_ASM */ #else /* !GUPROF */ #define MCOUNT_DECL(s) u_long s; #ifdef SMP @@ -108,7 +112,7 @@ void user(void); static void _mcount(uintfptr_t frompc, uintfptr_t selfpc) __used; \ static void _mcount -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM #define MCOUNT __asm(" \n\ .globl .mcount \n\ .type .mcount @function \n\ @@ -166,13 +170,13 @@ mcount() \ _mcount(frompc, selfpc); \ } #endif -#else /* !__GNUC__ */ +#else /* !__GNUCLIKE_ASM */ #define MCOUNT \ void \ mcount() \ { \ } -#endif /* __GNUC__ */ +#endif /* __GNUCLIKE_ASM */ typedef u_long uintfptr_t; @@ -193,7 +197,7 @@ void mcount(uintfptr_t frompc, uintfptr_t selfpc); #include <sys/cdefs.h> __BEGIN_DECLS -#ifdef __GNUC__ +#ifdef __GNUCLIKE_ASM void mcount(void) __asm(".mcount"); #endif __END_DECLS diff --git a/sys/amd64/include/stdarg.h b/sys/amd64/include/stdarg.h index 60a204ad177f..d3612d21e830 100644 --- a/sys/amd64/include/stdarg.h +++ b/sys/amd64/include/stdarg.h @@ -39,7 +39,7 @@ typedef __va_list va_list; #endif -#if defined(__GNUC__) +#if defined(__GNUCLIKE_BUILTIN_STDARG) #define va_start(ap, last) \ __builtin_stdarg_start((ap), (last)) @@ -67,6 +67,8 @@ typedef __va_list va_list; (*(type *)((ap) += __va_size(type), (ap) - __va_size(type))) #define va_end(ap) +#else +#error this file needs to be ported to your compiler #endif #endif /* !_MACHINE_STDARG_H_ */ diff --git a/sys/amd64/include/varargs.h b/sys/amd64/include/varargs.h index 1a58a47a8daa..3b9f542f28fd 100644 --- a/sys/amd64/include/varargs.h +++ b/sys/amd64/include/varargs.h @@ -43,7 +43,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> @@ -60,21 +64,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__ +#ifdef __GNUCLIKE_BUILTIN_VAALIST #define va_alist __builtin_va_alist #endif -#if __GNUC__ > 1 #define va_dcl int va_alist; ... -#else -#define va_dcl int va_alist; -#endif #define va_start(ap) \ ((ap) = (va_list)&va_alist) @@ -84,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_ */ |