Skip to content

Commit

Permalink
Reduced warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
rvanren committed Jan 10, 2025
1 parent c95032c commit 6a9e16f
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 9 deletions.
18 changes: 9 additions & 9 deletions harmony_model_checker/charm/charm.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,10 @@ static void direct_run(struct state *state, unsigned int id){
CI_POT_TRANSITION,
} trans;
} *ci = calloc( state->bagsize, sizeof(*ci));
unsigned int no_trans = 0;
unsigned int old_trans = 0;
unsigned int new_trans = 0;
unsigned int pot_trans = 0;
// unsigned int no_trans = 0;
// unsigned int old_trans = 0;
// unsigned int new_trans = 0;
// unsigned int pot_trans = 0;
for (int i = 0; i < state->bagsize; i++) {
ci[i].ctx = state_ctx(state, i);
unsigned int size;
Expand All @@ -475,7 +475,7 @@ static void direct_run(struct state *state, unsigned int id){
int cnt = dfa_visited(global.dfa, state->dfa_state, symbol);
if (cnt == 0) {
ci[i].trans = CI_NEW_TRANSITION;
new_trans++;
// new_trans++;
}
else if (cnt < 0) {
char *v = value_string(symbol);
Expand All @@ -484,19 +484,19 @@ static void direct_run(struct state *state, unsigned int id){
}
else if (dfa_potential(global.dfa, state->dfa_state, symbol) < 0) {
ci[i].trans = CI_OLD_TRANSITION;
old_trans++;
// old_trans++;
}
else {
ci[i].trans = CI_POT_TRANSITION;
pot_trans++;
// pot_trans++;
}
}
else {
ci[i].trans = CI_NO_TRANSITION;
no_trans++;
// no_trans++;
}
}
assert(no_trans + old_trans + new_trans + pot_trans== state->bagsize);
// assert(no_trans + old_trans + new_trans + pot_trans== state->bagsize);

int ctx_index = -1;
if (ctx_index < 0) { // random selection
Expand Down
18 changes: 18 additions & 0 deletions harmony_model_checker/charm/global.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,21 @@ void panic(char *s){
fprintf(stderr, "Panic: %s\n", s);
exit(1);
}


#ifdef __APPLE__
#ifdef __clang__
void *my_aligned_alloc(size_t alignment, size_t size){
if (__builtin_available(macOS 10.15, *)) {
return aligned_alloc(alignment, size);
}

static bool warned;
if (!warned) {
fprintf(stderr, "aligned_alloc not available in current version of MacOSX\n");
warned = true;
}
return malloc(size);
}
#endif
#endif
4 changes: 4 additions & 0 deletions harmony_model_checker/charm/head.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,11 @@
#else // _WIN32
#define ALIGNED_ALLOC
#include <stdlib.h>
#if defined(__APPLE__) && defined(__clang__)
void *my_aligned_alloc(size_t alignment, size_t size);
#else
#define my_aligned_alloc(a, s) aligned_alloc(a, s)
#endif // __APPLE__
#endif // _WIN32

#ifdef __linux__
Expand Down

0 comments on commit 6a9e16f

Please sign in to comment.