Ticket #506 (Invalid)Sun Feb 28 14:58:42 UTC 2021
DDE C compiler generates spurious warning
Reported by: | Dave Higton (1515) | Severity: | Minor |
Part: | RISC OS: C/C++ toolchain | Release: | |
Milestone: | Status | Invalid |
Details by Dave Higton (1515):
When building the AcornSSL module, the DDE 30 and 30a C compiler generates a spurious warning at two points, in the api_getpeername and api_getsockname functions. The warning is:
Warning variable ‘in’ declared but not used
The code in both cases is like this (pruned for clarity):
api_getpeername(, struct sockaddr *name,)
{
struct sockaddr_in *in = (struct sockaddr_in *)name;
dprintf((“api”, “getpeername %s on %p\n”, inet_ntoa(in->sin_addr), (void *)h));
}
The error line is shown to be that of the closing brace.
Clearly the variable ‘in’ has been used, so the warning should not be generated.
Changelog:
Modified by Dave Higton (1515) Sun, February 28 2021 - 17:47:42 GMT
- Status changed from Open to Invalid
dprintf is conditionally defined. The error occurs when dprintf isn’t defined.