It is not clear what you are trying to do here, but I assume that you are trying to do some pointer arithmetic using x and want x to be an integer for this arithmetic, but a pointer to void when returning. Without going into why this makes sense or doesn't make sense, you can eliminate this warning by explicitly pointing x to the void pointer.
void *myfunction() { int x = 5; return (void *)x; }
This will most likely trigger another warning, depending on how your system implements the pointers. You may need to use long instead of int.
void *myfunction() { long x = 5; return (void *)x; }
user2663103
source share