| Summary: | Compiler warning: unused variable 'i' [-Wunused-variable] | ||
|---|---|---|---|
| Product: | Red Hat Enterprise Linux 7 | Reporter: | ChunYu Wang <chunwang> |
| Component: | rpcbind | Assignee: | Steve Dickson <steved> |
| Status: | CLOSED ERRATA | QA Contact: | ChunYu Wang <chunwang> |
| Severity: | low | Docs Contact: | |
| Priority: | unspecified | ||
| Version: | 7.3 | CC: | eguan, steved, yoyang |
| Target Milestone: | rc | Keywords: | Patch |
| Target Release: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Whiteboard: | |||
| Fixed In Version: | rpcbind-0.2.0-39.el7 | Doc Type: | If docs needed, set a value |
| Doc Text: | Story Points: | --- | |
| Clone Of: | Environment: | ||
| Last Closed: | 2017-08-01 18:36:03 UTC | Type: | Bug |
| Regression: | --- | Mount Type: | --- |
| Documentation: | --- | CRM: | |
| Verified Versions: | Category: | --- | |
| oVirt Team: | --- | RHEL 7.3 requirements from Atomic Host: | |
| Cloudforms Team: | --- | Target Upstream Version: | |
(In reply to ChunYu Wang from comment #4) > If we just delete this declaration of 'i', the other 'i' instances in for > loops will get error with undeclared variable 'i', maybe it is better to > change i = 0 into int i = 0 in each loop, this will both avoid the original > unused 'i' problem and comply to C99 standard. No. If that was true there would not have been a warning. Plus those other SVC_RUN_DEBUG are in different routine. Moved to VERIFIED according to Comment 6, will keep an eye on related issues in future erratas. Since the problem described in this bug report should be resolved in a recent advisory, it has been closed with a resolution of ERRATA. For information on the advisory, and where to find the updated files, follow the link below. If the solution does not work for you, open a new bug report. https://access.redhat.com/errata/RHBA-2017:1992 |
If we just delete this declaration of 'i', the other 'i' instances in for loops will get error with undeclared variable 'i', maybe it is better to change i = 0 into int i = 0 in each loop, this will both avoid the original unused 'i' problem and comply to C99 standard. [chunwang@fs-qe src]$ cat ./rpcb_svc_com.c |egrep SVC_RUN_DEBUG -A 5 #ifdef SVC_RUN_DEBUG int i; #endif register struct pollfd *p; fd_set cleanfds; -- #ifdef SVC_RUN_DEBUG if (debugging) { fprintf(stderr, "polling for read on fd < "); for (i = 0, p = pollfds; i < nfds; i++, p++) if (p->events) fprintf(stderr, "%d ", p->fd); -- #ifdef SVC_RUN_DEBUG if (debugging) { fprintf(stderr, "poll returned read fds < "); for (i = 0, p = pollfds; i < nfds; i++, p++) if (p->revents) fprintf(stderr, "%d ", p->fd); -- <--snip--> [chunwang@fs-qe rpcbind]$ cat ./rpcbind-0.2.0-i-warn.patch diff -up rpcbind-0.2.0/src/rpcb_svc_com.c.orig rpcbind-0.2.0/src/rpcb_svc_com.c --- rpcbind-0.2.0/src/rpcb_svc_com.c.orig 2017-02-25 14:47:09.839325988 -0500 +++ rpcbind-0.2.0/src/rpcb_svc_com.c 2017-02-25 14:47:57.424187563 -0500 @@ -1106,9 +1106,6 @@ my_svc_run() struct pollfd pollfds[FD_SETSIZE]; int poll_ret, check_ret; int n; -#ifdef SVC_RUN_DEBUG - int i; -#endif register struct pollfd *p; fd_set cleanfds;