[PATCH 2/3] Cygwin: Variable 'prot' computed but never used
Jon Turney
jon.turney@dronecode.org.uk
Tue Sep 22 17:37:36 GMT 2026
../../../../src/winsup/cygserver/sysv_shm.cc: In function ‘int kern_shmat(thread*, int, const void*, int)’:
../../../../src/winsup/cygserver/sysv_shm.cc:345:19: error: variable ‘prot’ set but not used [-Werror=unused-but-set-variable=]
---
winsup/cygserver/sysv_shm.cc | 6 ++++++
1 file changed, 6 insertions(+)
diff --git a/winsup/cygserver/sysv_shm.cc b/winsup/cygserver/sysv_shm.cc
index 4578c53a2..322f9ed2f 100644
--- a/winsup/cygserver/sysv_shm.cc
+++ b/winsup/cygserver/sysv_shm.cc
@@ -342,7 +342,9 @@ kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg)
struct shm_handle *shm_handle;
#endif
vm_offset_t attach_va;
+#ifndef __CYGWIN__
vm_prot_t prot;
+#endif
vm_size_t size;
#ifndef __CYGWIN__
int rv;
@@ -379,13 +381,17 @@ kern_shmat(struct thread *td, int shmid, const void *shmaddr, int shmflg)
goto done2;
}
size = round_page(shmseg->shm_segsz);
+#ifndef __CYGWIN__
#ifdef VM_PROT_READ_IS_EXEC
prot = VM_PROT_READ | VM_PROT_EXECUTE;
#else
prot = VM_PROT_READ;
#endif
+#endif
+#ifndef __CYGWIN__
if ((shmflg & SHM_RDONLY) == 0)
prot |= VM_PROT_WRITE;
+#endif
flags = MAP_ANON | MAP_SHARED;
debug_printf ("shmaddr: %x, shmflg: %x", shmaddr, shmflg);
#ifdef __CYGWIN__
--
2.51.0
More information about the Cygwin-patches
mailing list