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

Address warnings related to casting of void* to 64 #401

Closed
wants to merge 5 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 core/lf_utils.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ function(lf_enable_compiler_warnings target)
elseif(${CMAKE_SYSTEM_NAME} STREQUAL "Darwin")
target_compile_options(${target} PRIVATE -Wall)
else()
target_compile_options(${target} PRIVATE -Wall)
target_compile_options(${target} PRIVATE -Wall -Werror)
endif()
endfunction()
6 changes: 3 additions & 3 deletions core/utils/pqueue.c
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ int event_matches(void* event1, void* event2) { return (((event_t*)event1)->trig

int reaction_matches(void* a, void* b) { return (a == b); }

pqueue_pri_t get_event_time(void* event) { return (pqueue_pri_t)(((event_t*)event)->time); }
instant_t get_event_time(void* event) { return (pqueue_pri_t)(((event_t*)event)->time); }

pqueue_pri_t get_reaction_index(void* reaction) { return ((reaction_t*)reaction)->index; }
index_t get_reaction_index(void* reaction) { return ((reaction_t*)reaction)->index; }

size_t get_event_position(void* event) { return ((event_t*)event)->pos; }

Expand All @@ -39,7 +39,7 @@ void set_reaction_position(void* reaction, size_t pos) { ((reaction_t*)reaction)

void print_reaction(void* reaction) {
reaction_t* r = (reaction_t*)reaction;
LF_PRINT_DEBUG("%s: chain_id: %llu, index: %llx, reaction: %p", r->name, r->chain_id, r->index, reaction);
LF_PRINT_DEBUG("%s: chain_id: %llu, index: " PRINTF_TIME ", reaction: %p", r->name, r->chain_id, r->index, reaction);
}

void print_event(void* event) {
Expand Down
4 changes: 2 additions & 2 deletions core/utils/pqueue_support.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ static pqueue_pri_t get_event_time(void* a) { return (pqueue_pri_t)(((event_t*)a
* Used for sorting pointers to reaction_t structs in the
* blocked and executing queues.
*/
static pqueue_pri_t get_reaction_index(void* a) { return ((reaction_t*)a)->index; }
static index_t get_reaction_index(void* a) { return ((reaction_t*)a)->index; }

/**
* Return the given event's position in the queue.
Expand Down Expand Up @@ -97,7 +97,7 @@ static void set_reaction_position(void* a, size_t pos) { ((reaction_t*)a)->pos =
*/
static void print_reaction(void* reaction) {
reaction_t* r = (reaction_t*)reaction;
LF_PRINT_DEBUG("%s: chain_id:%llu, index: %llx, reaction: %p", r->name, r->chain_id, r->index, (void*)r);
LF_PRINT_DEBUG("%s: chain_id:%llu, index: " PRINTF_TIME ", reaction: %p", r->name, r->chain_id, r->index, (void*)r);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion include/core/lf_types.h
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ typedef char* string;
#endif

/** Topological order index for reactions. */
typedef pqueue_pri_t index_t;
typedef uint64_t index_t;

/**
* Reaction function type. The argument passed to one of
Expand Down
2 changes: 1 addition & 1 deletion include/core/utils/pqueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pqueue_pri_t get_event_time(void* event);
* blocked and executing queues.
* @param reaction A pointer to a reaction_t.
*/
pqueue_pri_t get_reaction_index(void* reaction_t);
index_t get_reaction_index(void* reaction_t);

/**
* Return the given event's position in the queue.
Expand Down
3 changes: 2 additions & 1 deletion include/core/utils/pqueue_base.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,9 +39,10 @@
#define PQUEUE_BASE_H

#include <stddef.h>
#include <stdint.h>

/** Priority data type. */
typedef unsigned long long pqueue_pri_t;
typedef uintptr_t pqueue_pri_t;

/** Callback to get the priority of an element. */
typedef pqueue_pri_t (*pqueue_get_pri_f)(void* a);
Expand Down
Loading