Avoid mixing void and integer in a conditional expression.
authorTom Lane <[email protected]>
Sun, 2 Nov 2025 17:30:44 +0000 (12:30 -0500)
committerTom Lane <[email protected]>
Sun, 2 Nov 2025 17:31:17 +0000 (12:31 -0500)
The C standard says that the second and third arguments of a
conditional operator shall be both void type or both not-void
type.  The Windows version of INTERRUPTS_PENDING_CONDITION()
got this wrong.  It's pretty harmless because the result of
the operator is ignored anyway, but apparently recent versions
of MSVC have started issuing a warning about it.  Silence the
warning by casting the dummy zero to void.

Reported-by: Christian Ullrich <[email protected]>
Author: Bryan Green <[email protected]>
Reviewed-by: Tom Lane <[email protected]>
Discussion: https://postgr.es/m/cc4ef8db-f8dc-4347-8a22-e7ebf44c0308@chrullrich.net
Backpatch-through: 13

src/include/miscadmin.h

index 4438c09cee8aa21f4801edc366efe92242453936..73f09587c4e3ff2c4b4a0a977ee8eed4da270c6f 100644 (file)
@@ -113,7 +113,8 @@ extern void ProcessInterrupts(void);
    (unlikely(InterruptPending))
 #else
 #define INTERRUPTS_PENDING_CONDITION() \
-   (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? pgwin32_dispatch_queued_signals() : 0, \
+   (unlikely(UNBLOCKED_SIGNAL_QUEUE()) ? \
+    pgwin32_dispatch_queued_signals() : (void) 0, \
     unlikely(InterruptPending))
 #endif