Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cstyle: add basic understanding of top-level macro invocations #16840

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/os/freebsd/spl/sys/sdt.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,9 @@

#include_next <sys/sdt.h>
#ifdef KDTRACE_HOOKS
/* BEGIN CSTYLED */
SDT_PROBE_DECLARE(sdt, , , set__error);

/* BEGIN CSTYLED */
#define SET_ERROR(err) ({ \
SDT_PROBE1(sdt, , , set__error, (uintptr_t)err); \
err; \
Expand Down
28 changes: 0 additions & 28 deletions lib/libspl/atomic.c
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
(void) __atomic_add_fetch(target, 1, __ATOMIC_SEQ_CST); \
}

/* BEGIN CSTYLED */
ATOMIC_INC(8, uint8_t)
ATOMIC_INC(16, uint16_t)
ATOMIC_INC(32, uint32_t)
Expand All @@ -44,7 +43,6 @@ ATOMIC_INC(uchar, uchar_t)
ATOMIC_INC(ushort, ushort_t)
ATOMIC_INC(uint, uint_t)
ATOMIC_INC(ulong, ulong_t)
/* END CSTYLED */


#define ATOMIC_DEC(name, type) \
Expand All @@ -53,7 +51,6 @@ ATOMIC_INC(ulong, ulong_t)
(void) __atomic_sub_fetch(target, 1, __ATOMIC_SEQ_CST); \
}

/* BEGIN CSTYLED */
ATOMIC_DEC(8, uint8_t)
ATOMIC_DEC(16, uint16_t)
ATOMIC_DEC(32, uint32_t)
Expand All @@ -62,7 +59,6 @@ ATOMIC_DEC(uchar, uchar_t)
ATOMIC_DEC(ushort, ushort_t)
ATOMIC_DEC(uint, uint_t)
ATOMIC_DEC(ulong, ulong_t)
/* END CSTYLED */


#define ATOMIC_ADD(name, type1, type2) \
Expand All @@ -77,7 +73,6 @@ atomic_add_ptr(volatile void *target, ssize_t bits)
(void) __atomic_add_fetch((void **)target, bits, __ATOMIC_SEQ_CST);
}

/* BEGIN CSTYLED */
ATOMIC_ADD(8, uint8_t, int8_t)
ATOMIC_ADD(16, uint16_t, int16_t)
ATOMIC_ADD(32, uint32_t, int32_t)
Expand All @@ -86,7 +81,6 @@ ATOMIC_ADD(char, uchar_t, signed char)
ATOMIC_ADD(short, ushort_t, short)
ATOMIC_ADD(int, uint_t, int)
ATOMIC_ADD(long, ulong_t, long)
/* END CSTYLED */


#define ATOMIC_SUB(name, type1, type2) \
Expand All @@ -101,7 +95,6 @@ atomic_sub_ptr(volatile void *target, ssize_t bits)
(void) __atomic_sub_fetch((void **)target, bits, __ATOMIC_SEQ_CST);
}

/* BEGIN CSTYLED */
ATOMIC_SUB(8, uint8_t, int8_t)
ATOMIC_SUB(16, uint16_t, int16_t)
ATOMIC_SUB(32, uint32_t, int32_t)
Expand All @@ -110,7 +103,6 @@ ATOMIC_SUB(char, uchar_t, signed char)
ATOMIC_SUB(short, ushort_t, short)
ATOMIC_SUB(int, uint_t, int)
ATOMIC_SUB(long, ulong_t, long)
/* END CSTYLED */


#define ATOMIC_OR(name, type) \
Expand All @@ -119,7 +111,6 @@ ATOMIC_SUB(long, ulong_t, long)
(void) __atomic_or_fetch(target, bits, __ATOMIC_SEQ_CST); \
}

/* BEGIN CSTYLED */
ATOMIC_OR(8, uint8_t)
ATOMIC_OR(16, uint16_t)
ATOMIC_OR(32, uint32_t)
Expand All @@ -128,7 +119,6 @@ ATOMIC_OR(uchar, uchar_t)
ATOMIC_OR(ushort, ushort_t)
ATOMIC_OR(uint, uint_t)
ATOMIC_OR(ulong, ulong_t)
/* END CSTYLED */


#define ATOMIC_AND(name, type) \
Expand All @@ -137,7 +127,6 @@ ATOMIC_OR(ulong, ulong_t)
(void) __atomic_and_fetch(target, bits, __ATOMIC_SEQ_CST); \
}

/* BEGIN CSTYLED */
ATOMIC_AND(8, uint8_t)
ATOMIC_AND(16, uint16_t)
ATOMIC_AND(32, uint32_t)
Expand All @@ -146,7 +135,6 @@ ATOMIC_AND(uchar, uchar_t)
ATOMIC_AND(ushort, ushort_t)
ATOMIC_AND(uint, uint_t)
ATOMIC_AND(ulong, ulong_t)
/* END CSTYLED */


/*
Expand All @@ -159,7 +147,6 @@ ATOMIC_AND(ulong, ulong_t)
return (__atomic_add_fetch(target, 1, __ATOMIC_SEQ_CST)); \
}

/* BEGIN CSTYLED */
ATOMIC_INC_NV(8, uint8_t)
ATOMIC_INC_NV(16, uint16_t)
ATOMIC_INC_NV(32, uint32_t)
Expand All @@ -168,7 +155,6 @@ ATOMIC_INC_NV(uchar, uchar_t)
ATOMIC_INC_NV(ushort, ushort_t)
ATOMIC_INC_NV(uint, uint_t)
ATOMIC_INC_NV(ulong, ulong_t)
/* END CSTYLED */


#define ATOMIC_DEC_NV(name, type) \
Expand All @@ -177,7 +163,6 @@ ATOMIC_INC_NV(ulong, ulong_t)
return (__atomic_sub_fetch(target, 1, __ATOMIC_SEQ_CST)); \
}

/* BEGIN CSTYLED */
ATOMIC_DEC_NV(8, uint8_t)
ATOMIC_DEC_NV(16, uint16_t)
ATOMIC_DEC_NV(32, uint32_t)
Expand All @@ -186,7 +171,6 @@ ATOMIC_DEC_NV(uchar, uchar_t)
ATOMIC_DEC_NV(ushort, ushort_t)
ATOMIC_DEC_NV(uint, uint_t)
ATOMIC_DEC_NV(ulong, ulong_t)
/* END CSTYLED */


#define ATOMIC_ADD_NV(name, type1, type2) \
Expand All @@ -201,7 +185,6 @@ atomic_add_ptr_nv(volatile void *target, ssize_t bits)
return (__atomic_add_fetch((void **)target, bits, __ATOMIC_SEQ_CST));
}

/* BEGIN CSTYLED */
ATOMIC_ADD_NV(8, uint8_t, int8_t)
ATOMIC_ADD_NV(16, uint16_t, int16_t)
ATOMIC_ADD_NV(32, uint32_t, int32_t)
Expand All @@ -210,7 +193,6 @@ ATOMIC_ADD_NV(char, uchar_t, signed char)
ATOMIC_ADD_NV(short, ushort_t, short)
ATOMIC_ADD_NV(int, uint_t, int)
ATOMIC_ADD_NV(long, ulong_t, long)
/* END CSTYLED */


#define ATOMIC_SUB_NV(name, type1, type2) \
Expand All @@ -225,7 +207,6 @@ atomic_sub_ptr_nv(volatile void *target, ssize_t bits)
return (__atomic_sub_fetch((void **)target, bits, __ATOMIC_SEQ_CST));
}

/* BEGIN CSTYLED */
ATOMIC_SUB_NV(8, uint8_t, int8_t)
ATOMIC_SUB_NV(char, uchar_t, signed char)
ATOMIC_SUB_NV(16, uint16_t, int16_t)
Expand All @@ -234,7 +215,6 @@ ATOMIC_SUB_NV(32, uint32_t, int32_t)
ATOMIC_SUB_NV(int, uint_t, int)
ATOMIC_SUB_NV(long, ulong_t, long)
ATOMIC_SUB_NV(64, uint64_t, int64_t)
/* END CSTYLED */


#define ATOMIC_OR_NV(name, type) \
Expand All @@ -243,7 +223,6 @@ ATOMIC_SUB_NV(64, uint64_t, int64_t)
return (__atomic_or_fetch(target, bits, __ATOMIC_SEQ_CST)); \
}

/* BEGIN CSTYLED */
ATOMIC_OR_NV(8, uint8_t)
ATOMIC_OR_NV(16, uint16_t)
ATOMIC_OR_NV(32, uint32_t)
Expand All @@ -252,7 +231,6 @@ ATOMIC_OR_NV(uchar, uchar_t)
ATOMIC_OR_NV(ushort, ushort_t)
ATOMIC_OR_NV(uint, uint_t)
ATOMIC_OR_NV(ulong, ulong_t)
/* END CSTYLED */


#define ATOMIC_AND_NV(name, type) \
Expand All @@ -261,7 +239,6 @@ ATOMIC_OR_NV(ulong, ulong_t)
return (__atomic_and_fetch(target, bits, __ATOMIC_SEQ_CST)); \
}

/* BEGIN CSTYLED */
ATOMIC_AND_NV(8, uint8_t)
ATOMIC_AND_NV(16, uint16_t)
ATOMIC_AND_NV(32, uint32_t)
Expand All @@ -270,7 +247,6 @@ ATOMIC_AND_NV(uchar, uchar_t)
ATOMIC_AND_NV(ushort, ushort_t)
ATOMIC_AND_NV(uint, uint_t)
ATOMIC_AND_NV(ulong, ulong_t)
/* END CSTYLED */


/*
Expand Down Expand Up @@ -300,7 +276,6 @@ atomic_cas_ptr(volatile void *target, void *exp, void *des)
return (exp);
}

/* BEGIN CSTYLED */
ATOMIC_CAS(8, uint8_t)
ATOMIC_CAS(16, uint16_t)
ATOMIC_CAS(32, uint32_t)
Expand All @@ -309,7 +284,6 @@ ATOMIC_CAS(uchar, uchar_t)
ATOMIC_CAS(ushort, ushort_t)
ATOMIC_CAS(uint, uint_t)
ATOMIC_CAS(ulong, ulong_t)
/* END CSTYLED */


/*
Expand All @@ -322,7 +296,6 @@ ATOMIC_CAS(ulong, ulong_t)
return (__atomic_exchange_n(target, bits, __ATOMIC_SEQ_CST)); \
}

/* BEGIN CSTYLED */
ATOMIC_SWAP(8, uint8_t)
ATOMIC_SWAP(16, uint16_t)
ATOMIC_SWAP(32, uint32_t)
Expand All @@ -331,7 +304,6 @@ ATOMIC_SWAP(uchar, uchar_t)
ATOMIC_SWAP(ushort, ushort_t)
ATOMIC_SWAP(uint, uint_t)
ATOMIC_SWAP(ulong, ulong_t)
/* END CSTYLED */

void *
atomic_swap_ptr(volatile void *target, void *bits)
Expand Down
2 changes: 0 additions & 2 deletions module/nvpair/nvpair.c
Original file line number Diff line number Diff line change
Expand Up @@ -3281,15 +3281,13 @@ nvs_xdr_nvp_##type(XDR *xdrs, void *ptr, ...) \

#endif

/* BEGIN CSTYLED */
NVS_BUILD_XDRPROC_T(char);
NVS_BUILD_XDRPROC_T(short);
NVS_BUILD_XDRPROC_T(u_short);
NVS_BUILD_XDRPROC_T(int);
NVS_BUILD_XDRPROC_T(u_int);
NVS_BUILD_XDRPROC_T(longlong_t);
NVS_BUILD_XDRPROC_T(u_longlong_t);
/* END CSTYLED */

/*
* The format of xdr encoded nvpair is:
Expand Down
1 change: 0 additions & 1 deletion module/os/freebsd/spl/spl_dtrace.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,5 +31,4 @@
#include <sys/queue.h>
#include <sys/sdt.h>

/* CSTYLED */
SDT_PROBE_DEFINE1(sdt, , , set__error, "int");
Loading
Loading