diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-02-14 00:55:23 +0100 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2025-02-14 00:55:23 +0100 |
commit | cfa9ca2f0d33eabbffba79fba5ff4859d681b209 (patch) | |
tree | 700a69a8cd95718f31ad75b1f875541b79c961f7 | |
parent | 00e36dabb4cdef51095aece46e451f2fab4c13c1 (diff) |
Avoid MACRO_BEGIN/END for installed files
-rw-r--r-- | include/device/bpf.h | 12 | ||||
-rw-r--r-- | include/mach/profil.h | 16 | ||||
-rw-r--r-- | include/mach/time_value.h | 52 |
3 files changed, 40 insertions, 40 deletions
diff --git a/include/device/bpf.h b/include/device/bpf.h index 0f80318e..1d00e8c6 100644 --- a/include/device/bpf.h +++ b/include/device/bpf.h @@ -202,30 +202,30 @@ typedef struct bpf_insn *bpf_insn_t; #define BPF_RETMATCH(code, k, nkey) { (unsigned short)(code), nkey, 0, k } #define BPF_INSN_STMT(pc, c, n) \ -MACRO_BEGIN \ +do { \ (pc)->code = (c); \ (pc)->jt = (pc)->jf = 0; \ (pc)->k = (n); \ (pc)++; \ -MACRO_END +} while(0) #define BPF_INSN_JUMP(pc, c, n, jtrue, jfalse) \ -MACRO_BEGIN \ +do { \ (pc)->code = (c); \ (pc)->jt = (jtrue); \ (pc)->jf = (jfalse); \ (pc)->k = (n); \ (pc)++; \ -MACRO_END +} while(0) #define BPF_INSN_RETMATCH(pc, c, n, nkey) \ -MACRO_BEGIN \ +do { \ (pc)->code = (c); \ (pc)->jt = (nkey); \ (pc)->jf = 0; \ (pc)->k = (n); \ (pc)++; \ -MACRO_END +} while(0) /* * Number of scratch memory words (for BPF_LD|BPF_MEM and BPF_ST). diff --git a/include/mach/profil.h b/include/mach/profil.h index aa92bc4d..9c6e983f 100644 --- a/include/mach/profil.h +++ b/include/mach/profil.h @@ -96,7 +96,7 @@ typedef struct buffer *buffer_t; extern vm_map_t kernel_map; #define dealloc_pbuf_area(pbuf) \ - MACRO_BEGIN \ + do { \ register int i; \ \ for(i=0; i < NB_PROF_BUFFER ; i++) \ @@ -106,11 +106,11 @@ extern vm_map_t kernel_map; kmem_free(kernel_map, \ (vm_offset_t)(pbuf), \ sizeof(struct prof_data)); \ - MACRO_END + } while(0) #define alloc_pbuf_area(pbuf, vmpbuf) \ -MACRO_BEGIN \ +do { \ (vmpbuf) = (vm_offset_t) 0; \ if (kmem_alloc(kernel_map, &(vmpbuf) , sizeof(struct prof_data)) == \ KERN_SUCCESS) { \ @@ -132,7 +132,7 @@ MACRO_BEGIN \ } \ else \ (pbuf) = NULLPBUF; \ -MACRO_END +} while(0) @@ -148,7 +148,7 @@ MACRO_END */ #define set_pbuf_value(pbuf, val) \ - MACRO_BEGIN \ + do { \ register buffer_t a = &((pbuf)->prof_area[(pbuf)->prof_index]); \ register int i = a->p_index++; \ register boolean_t f = a->p_full; \ @@ -164,16 +164,16 @@ MACRO_END else \ *(val) = 1; \ } \ - MACRO_END + } while(0) #define reset_pbuf_area(pbuf) \ - MACRO_BEGIN \ + do { \ register int *i = &((pbuf)->prof_index); \ \ *i = (*i == NB_PROF_BUFFER-1) ? 0 : ++(*i); \ (pbuf)->prof_area[*i].p_index = 0; \ - MACRO_END + } while(0) /**************************************************************/ diff --git a/include/mach/time_value.h b/include/mach/time_value.h index 0c89f4eb..8274197d 100644 --- a/include/mach/time_value.h +++ b/include/mach/time_value.h @@ -94,7 +94,7 @@ static __inline__ time_value_t convert_time_value_from_user(rpc_time_value_t tv) assert(0 <= (val)->nanoseconds && (val)->nanoseconds < TIME_NANOS_MAX); #define time_value_add_usec(val, micros) \ -MACRO_BEGIN \ +do { \ time_value_assert(val); \ if (((val)->microseconds += (micros)) \ >= TIME_MICROS_MAX) { \ @@ -102,10 +102,10 @@ MACRO_BEGIN \ (val)->seconds++; \ } \ time_value_assert(val); \ -MACRO_END +} while(0) #define time_value64_add_nanos(val, nanos) \ -MACRO_BEGIN \ +do { \ time_value64_assert(val); \ if (((val)->nanoseconds += (nanos)) \ >= TIME_NANOS_MAX) { \ @@ -113,56 +113,56 @@ MACRO_BEGIN \ (val)->seconds++; \ } \ time_value64_assert(val); \ -MACRO_END +} while(0) #define time_value64_sub_nanos(val, nanos) \ -MACRO_BEGIN \ +do { \ time_value64_assert(val); \ if (((val)->nanoseconds -= (nanos)) < 0) { \ (val)->nanoseconds += TIME_NANOS_MAX; \ (val)->seconds--; \ } \ time_value64_assert(val); \ -MACRO_END +} while(0) #define time_value_add(result, addend) \ -MACRO_BEGIN \ +do { \ time_value_assert(addend); \ (result)->seconds += (addend)->seconds; \ time_value_add_usec(result, (addend)->microseconds); \ -MACRO_END +} while(0) #define time_value64_add(result, addend) \ -MACRO_BEGIN \ +do { \ time_value64_assert(addend); \ (result)->seconds += (addend)->seconds; \ time_value64_add_nanos(result, (addend)->nanoseconds); \ -MACRO_END +} while(0) #define time_value64_sub(result, subtrahend) \ -MACRO_BEGIN \ +do { \ time_value64_assert(subtrahend); \ (result)->seconds -= (subtrahend)->seconds; \ time_value64_sub_nanos(result, (subtrahend)->nanoseconds); \ -MACRO_END +} while(0) #define time_value64_init(tv) \ -MACRO_BEGIN \ +do { \ (tv)->seconds = 0; \ (tv)->nanoseconds = 0; \ -MACRO_END +} while(0) #define TIME_VALUE64_TO_TIME_VALUE(tv64, tv) \ -MACRO_BEGIN \ +do { \ (tv)->seconds = (tv64)->seconds; \ (tv)->microseconds = (tv64)->nanoseconds / 1000; \ -MACRO_END +} while(0) #define TIME_VALUE_TO_TIME_VALUE64(tv, tv64) \ -MACRO_BEGIN \ +do { \ (tv64)->seconds = (tv)->seconds; \ (tv64)->nanoseconds = (tv)->microseconds * 1000; \ -MACRO_END +} while(0) /* * Time value available through the mapped-time interface. @@ -188,29 +188,29 @@ typedef struct mapped_time_value { /* Macros for converting between struct timespec and time_value_t. */ #define TIME_VALUE_TO_TIMESPEC(tv, ts) \ -MACRO_BEGIN \ +do { \ (ts)->tv_sec = (tv)->seconds; \ (ts)->tv_nsec = (tv)->microseconds * 1000; \ -MACRO_END +} while(0) #define TIMESPEC_TO_TIME_VALUE(tv, ts) \ -MACRO_BEGIN \ +do { \ (tv)->seconds = (ts)->tv_sec; \ (tv)->microseconds = (ts)->tv_nsec / 1000; \ -MACRO_END +} while(0) /* Macros for converting between struct timespec and time_value64_t. */ #define TIME_VALUE64_TO_TIMESPEC(tv, ts) \ -MACRO_BEGIN \ +do { \ (ts)->tv_sec = (tv)->seconds; \ (ts)->tv_nsec = (tv)->nanoseconds; \ -MACRO_END +} while(0) #define TIMESPEC_TO_TIME_VALUE64(tv, ts) \ -MACRO_BEGIN \ +do { \ (tv)->seconds = (ts)->tv_sec; \ (tv)->nanoseconds = (ts)->tv_nsec; \ -MACRO_END +} while(0) #endif /* _MACH_TIME_VALUE_H_ */ |