Yigal Hochberg
2003-02-26 10:23:08 UTC
Bernhard,
I think there is a problem in the sdcc compiler when function pointer
is used in a structure field.
In foo1() sdcc does not like the call to myabc.funcptr().
I get this error with sdcc.
================<< start quote ============================
cd f:/yigal/snmp.201/agent/
d:\sdcc\bin\sdcc -c --model-large t.c
t.c:34: warning: Functions called via pointers must be 'reentrant' to take arguments
Compilation finished at Wed Feb 26 07:16:28
================== end quote >>==============================
Any suggestion how to solve this?
Thank you.
--
- Yigal
#if !defined(SDCC)
#define reentrant
#endif
typedef int (Funcptr_t)(int x, int y, char *z) reentrant; /* function pointer type */
struct abc {
Funcptr_t *funcptr;
};
void
foo(int a,
int (*func_ptr)(int x, int y, char *z) reentrant, /* function pointer */
int b)
{
a = 5;
b = 5;
(*func_ptr)(a, b, "hello");
}
void
foo1(int a,
Funcptr_t *func_ptr,
int b)
{
struct abc myabc;
a = 5;
b = 5;
(*func_ptr)(a, b, "hello");
(*myabc.funcptr)(a, b,"hello"); /* sdcc does not like it */
}
/*
* Local Variables:
* cc: "d:\\sdcc\\bin\\sdcc"
* cc-flags: "-c --model-large"
* eval: (make-local-variable 'compile-command)
* eval: (setq compile-command (concat cc " " cc-flags " "
(file-name-nondirectory buffer-file-name)))
* End:
*/
I think there is a problem in the sdcc compiler when function pointer
is used in a structure field.
In foo1() sdcc does not like the call to myabc.funcptr().
I get this error with sdcc.
================<< start quote ============================
cd f:/yigal/snmp.201/agent/
d:\sdcc\bin\sdcc -c --model-large t.c
t.c:34: warning: Functions called via pointers must be 'reentrant' to take arguments
Compilation finished at Wed Feb 26 07:16:28
================== end quote >>==============================
Any suggestion how to solve this?
Thank you.
--
- Yigal
#if !defined(SDCC)
#define reentrant
#endif
typedef int (Funcptr_t)(int x, int y, char *z) reentrant; /* function pointer type */
struct abc {
Funcptr_t *funcptr;
};
void
foo(int a,
int (*func_ptr)(int x, int y, char *z) reentrant, /* function pointer */
int b)
{
a = 5;
b = 5;
(*func_ptr)(a, b, "hello");
}
void
foo1(int a,
Funcptr_t *func_ptr,
int b)
{
struct abc myabc;
a = 5;
b = 5;
(*func_ptr)(a, b, "hello");
(*myabc.funcptr)(a, b,"hello"); /* sdcc does not like it */
}
/*
* Local Variables:
* cc: "d:\\sdcc\\bin\\sdcc"
* cc-flags: "-c --model-large"
* eval: (make-local-variable 'compile-command)
* eval: (setq compile-command (concat cc " " cc-flags " "
(file-name-nondirectory buffer-file-name)))
* End:
*/