Skip to content

Commit

Permalink
Reformatted _FFF_VERIFY_ANY_CALL macro
Browse files Browse the repository at this point in the history
Formatting had been garbled. No syntax change / changed type of verified
from into to bool...
  • Loading branch information
cormacc committed Aug 9, 2022
1 parent 19f7392 commit a64e0a6
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions fff.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,10 +126,10 @@ SOFTWARE.

#ifdef __cplusplus
#define FFF_EXTERN_C extern "C"{
#define FFF_END_EXTERN_C }
#define FFF_END_EXTERN_C }
#else /* ansi c */
#define FFF_EXTERN_C
#define FFF_END_EXTERN_C
#define FFF_EXTERN_C
#define FFF_END_EXTERN_C
#endif /* cpp/ansi c */

#define DEFINE_RESET_FUNCTION(FUNCNAME) \
Expand All @@ -149,12 +149,21 @@ SOFTWARE.

//This uses GCC compound statement expression:
//https://gcc.gnu.org/onlinedocs/gcc/Statement-Exprs.html
#define _FFF_VERIFY_ANY_CALL(FN, ...) ({ int verified = 0; int call_idx = FFF_CALLS(FN); while(call_idx && !verified) { verified |= _FFF_VERIFY_NTH_CALL(FN, call_idx, __VA_ARGS__); call_idx--; } verified; })
#define _FFF_VERIFY_ANY_CALL(FN, ...) \
({ \
bool verified = false; \
int call_idx = FFF_CALLS(FN); \
while (call_idx && !verified) { \
verified |= _FFF_VERIFY_NTH_CALL(FN, call_idx, __VA_ARGS__); \
call_idx--; \
} \
verified; \
})

/* -- END INTERNAL HELPER MACROS -- */

typedef void (*fff_function_t)(void);
typedef struct {
typedef struct {
fff_function_t call_history[FFF_CALL_HISTORY_LEN];
unsigned int call_history_idx;
} fff_globals_t;
Expand Down

0 comments on commit a64e0a6

Please sign in to comment.