Add -Wundef to compiler flags

Today was another time I used `#if PG14_LT` but forgot to include
compat.h, spent a good deal of time debugging this. This flag will
catch references to undefined macros.
This commit is contained in:
Alexander Kuzmenkov 2021-12-16 20:29:21 +03:00 committed by Alexander Kuzmenkov
parent e0f02c8c1a
commit da5ee6fc41
4 changed files with 6 additions and 5 deletions

View File

@ -194,6 +194,7 @@ if(CMAKE_C_COMPILER_ID MATCHES "GNU|AppleClang|Clang")
-Wempty-body -Wempty-body
-Wvla -Wvla
-Wall -Wall
-Wundef
-Wmissing-prototypes -Wmissing-prototypes
-Wpointer-arith -Wpointer-arith
-Werror=vla -Werror=vla

View File

@ -139,7 +139,7 @@ ts_bgw_start_worker(const char *function, const char *name, const char *extra)
return handle; return handle;
} }
#if USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
static void static void
assert_that_worker_has_stopped(ScheduledBgwJob *sjob) assert_that_worker_has_stopped(ScheduledBgwJob *sjob)
{ {
@ -177,7 +177,7 @@ worker_state_cleanup(ScheduledBgwJob *sjob)
*/ */
if (sjob->handle != NULL) if (sjob->handle != NULL)
{ {
#if USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
/* Sanity check: worker has stopped (if it was started) */ /* Sanity check: worker has stopped (if it was started) */
assert_that_worker_has_stopped(sjob); assert_that_worker_has_stopped(sjob);
#endif #endif
@ -239,7 +239,7 @@ worker_state_cleanup(ScheduledBgwJob *sjob)
static void static void
scheduled_bgw_job_transition_state_to(ScheduledBgwJob *sjob, JobState new_state) scheduled_bgw_job_transition_state_to(ScheduledBgwJob *sjob, JobState new_state)
{ {
#if USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
JobState prev_state = sjob->state; JobState prev_state = sjob->state;
#endif #endif

View File

@ -27,7 +27,7 @@
#include <miscadmin.h> #include <miscadmin.h>
#include <fmgr.h> #include <fmgr.h>
#if USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
#include <funcapi.h> #include <funcapi.h>
#endif #endif

View File

@ -27,7 +27,7 @@
#include <fmgr.h> #include <fmgr.h>
#include <executor/spi.h> #include <executor/spi.h>
#if USE_ASSERT_CHECKING #ifdef USE_ASSERT_CHECKING
#include <funcapi.h> #include <funcapi.h>
#endif #endif