-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
inference: follow up #44515, correctly encode Effects.overlayed
effect
#44634
Conversation
4e59806
to
83e68a0
Compare
83e68a0
to
872180f
Compare
872180f
to
966f860
Compare
static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT | ||
{ | ||
ios_write(s, (char*)&i, 4); | ||
} | ||
|
||
static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT | ||
{ | ||
uint32_t x = 0; | ||
ios_read(s, (char*)&x, 4); | ||
return x; | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These functions are duplicates of
Lines 371 to 381 in c503611
static void write_uint32(ios_t *s, uint32_t i) JL_NOTSAFEPOINT | |
{ | |
ios_write(s, (char*)&i, 4); | |
} | |
static uint32_t read_uint32(ios_t *s) JL_NOTSAFEPOINT | |
{ | |
uint32_t x = 0; | |
ios_read(s, (char*)&x, 4); | |
return x; | |
} |
ircode.c
which doesn't use these functions. I'm not even sure why there are functions implementations in a header.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the best way in C to define utility functions in a single place and import them from several places? In this case, dump.c uses all write_xxx
utilities defined in serialize.h while ircode.c only uses some of them and so #include serialize.h
produced that warning (and the same thing would happen for staticdata.c if we remove the duplications).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the best way in C to define utility functions in a single place and import them from several places?
Move the implementations (not the prototypes!) to a .c
file, and make the files which need those functions depend on its corresponding object file in src/Makefile
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't the reason it is done like this to make the function definition available in all translation units and thus be eligible for inlining? But these functions are not marked inline
though... But, to me, for consistency, the function in staticdata.c
should be removed and this header included there instead?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
xref: #44515 (comment)