Skip to contentSkip to conversation

xv: Avoid shadowed declaration of 'int i' in NVPutImage

PATCH In review Rhys Kidd 2 participants 3 messages Jan 21, 2019 2 messages not in the archive

lore
Share & tools
lore

Rhys Kidd

author
#0 lore raw

PATCH 1/2 xv: Avoid shadowed declaration of 'int i' in NVPutImage

int i is accessed outside immediate scope so leave declaration at the highest common scope level:

  1073:  int ret, i;
         ...
         // Highest common scope
         ...
  1193:  if (newTTSize <= destination_buffer->size) {
           ...
           // Used in this scope
           ...
  1248:  } else {
           ...
           // Used in this scope
           ...
  1316:  }
         // Not used in this scope

Warning reported by gcc 8.2:

nouveau_xv.c: In function ‘NVPutImage’:
nouveau_xv.c:1195:7: warning: declaration of ‘i’ shadows a previous local [-Wshadow]

   int i = 0;
       ^
nouveau_xv.c:1073:11: note: shadowed declaration is here
  int ret, i;
           ^
---
 src/nouveau_xv.c | 1 -
 1 file changed, 1 deletion(-)
src/nouveau_xv.c +0 -1
index a7ec21a..1afe2f1 100644
@@ -1192,7 +1192,6 @@ NVPutImage(ScrnInfoPtr pScrn, short src_x, short src_y, short drw_x,
 
 	if (newTTSize <= destination_buffer->size) {
 		unsigned char *dst;
-		int i = 0;
 
 		/* Upload to GART */
 		nouveau_bo_map(destination_buffer, NOUVEAU_BO_WR, pNv->client);
Signature · 6 lines
2.19.1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20190121023119.1012-1-rhyskidd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

author
#2 lore raw

PATCH 2/2 xv: Avoid shadowed declaration of 'int ret' in NVPutImage

Warning reported by gcc 8.2:

nouveau_xv.c: In function ‘NVPutImage’:
nouveau_xv.c:1369:7: warning: declaration of ‘ret’ shadows a previous local [-Wshadow]

   int ret = BadImplementation;
       ^~~
nouveau_xv.c:1073:6: note: shadowed declaration is here
  int ret, i;
      ^~~
Fixes a50bba6 ("xv: misc cleanups")
Cc Ben Skeggs <[email protected]>
---
 src/nouveau_xv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/nouveau_xv.c +1 -1
index 1afe2f1..9d955e0 100644
@@ -1366,7 +1366,7 @@ CPU_copy:
 		pPriv->currentBuffer ^= 1;
 	} else 
 	if (action_flags & USE_TEXTURE) {
-		int ret = BadImplementation;
+		ret = BadImplementation;
 
 		if (pNv->Architecture == NV_ARCH_30) {
 			ret = NV30PutTextureImage(pScrn, pPriv->video_mem,
Signature · 6 lines
2.19.1

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

A message that is not in the archive (sent off-list or not yet received): 20190121023119.1012-2-rhyskidd-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org

#4 lore raw

Re: [PATCH xf86-video-nouveau 2/2] xv: Avoid shadowed declaration of 'int ret' in NVPutImage

Thanks, series pushed.

Quoted 34 lines · Rhys Kidd

Warning reported by gcc 8.2:

nouveau_xv.c: In function ‘NVPutImage’:
nouveau_xv.c:1369:7: warning: declaration of ‘ret’ shadows a previous local [-Wshadow]

   int ret = BadImplementation;
       ^~~
nouveau_xv.c:1073:6: note: shadowed declaration is here
  int ret, i;
      ^~~
Fixes a50bba6 ("xv: misc cleanups")
Cc Ben Skeggs <[email protected]>
---
 src/nouveau_xv.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
src/nouveau_xv.c +1 -2
index 1afe2f1..9d955e0 100644
@@ -1366,7 +1366,7 @@ CPU_copy:
                pPriv->currentBuffer ^= 1;
        } else
        if (action_flags & USE_TEXTURE) {
-               int ret = BadImplementation;
+               ret = BadImplementation;
 
                if (pNv->Architecture == NV_ARCH_30) {
                        ret = NV30PutTextureImage(pScrn, pPriv->video_mem,
--

2.19.1

Quoted 4 lines

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau

_______________________________________________
Nouveau mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/nouveau