Work around gcc warning about function pointers conversions.
Work around harmless (at least under POSIX systems where function pointers are guaranteed to have the same representation as object pointers) but annoying warnings given by gcc when converting between function and object pointers, e.g. Source/DOH/fio.c: In function 'DohEncoding': Source/DOH/fio.c:51: warning: ISO C forbids conversion of function pointer to object pointer type Source/DOH/fio.c: In function 'encode': Source/DOH/fio.c:75: warning: ISO C forbids conversion of object pointer to function pointer type Source/DOH/base.c: In function 'DohCall': Source/DOH/base.c:952: warning: ISO C forbids conversion of object pointer to function pointer type Use an extra level of pointer indirection to avoid them.
This commit is contained in:
parent
90eb5f9095
commit
40bf877499
2 changed files with 3 additions and 3 deletions
|
|
@ -949,7 +949,7 @@ DOH *DohCall(DOH *func, DOH *args) {
|
|||
DOH *result;
|
||||
DOH *(*builtin) (DOH *);
|
||||
|
||||
builtin = (DOH *(*)(DOH *)) GetVoid(func, "builtin");
|
||||
*(void **)(&builtin) = GetVoid(func, "builtin");
|
||||
if (!builtin)
|
||||
return 0;
|
||||
result = (*builtin) (args);
|
||||
|
|
|
|||
|
|
@ -48,7 +48,7 @@ static int Writen(DOH *out, void *buffer, int len) {
|
|||
void DohEncoding(const char *name, DOH *(*fn) (DOH *s)) {
|
||||
if (!encodings)
|
||||
encodings = NewHash();
|
||||
Setattr(encodings, (void *) name, NewVoid((void *) fn, 0));
|
||||
Setattr(encodings, (void *) name, NewVoid(*(void **)&fn, 0));
|
||||
}
|
||||
|
||||
/* internal function for processing an encoding */
|
||||
|
|
@ -72,7 +72,7 @@ static DOH *encode(char *name, DOH *s) {
|
|||
s = tmp;
|
||||
pos = Tell(s);
|
||||
Seek(s, 0, SEEK_SET);
|
||||
fn = (DOH *(*)(DOH *)) Data(handle);
|
||||
*(void **)(&fn) = Data(handle);
|
||||
ns = (*fn) (s);
|
||||
assert(pos != -1);
|
||||
(void)Seek(s, pos, SEEK_SET);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue