public inbox for [email protected]help / color / mirror / Atom feed
[PATCH] Add -Wold-style-definition to CFLAGS. 3+ messages / 3 participants [nested] [flat]
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Andres Freund @ 2020-05-09 17:38 UTC (permalink / raw) Author: Reviewed-By: Discussion: https://postgr.es/m/ Backpatch: --- src/backend/postmaster/autovacuum.c | 2 +- src/backend/storage/buffer/freelist.c | 2 +- src/backend/utils/adt/jsonpath_scan.l | 2 +- src/backend/utils/misc/queryenvironment.c | 2 +- src/interfaces/libpq/fe-misc.c | 2 +- configure | 41 +++++++++++++++++++++++ configure.in | 2 ++ 7 files changed, 48 insertions(+), 5 deletions(-) diff --git a/src/backend/postmaster/autovacuum.c b/src/backend/postmaster/autovacuum.c index 7e97ffab27d..5641f59016d 100644 --- a/src/backend/postmaster/autovacuum.c +++ b/src/backend/postmaster/autovacuum.c @@ -834,7 +834,7 @@ HandleAutoVacLauncherInterrupts(void) * Perform a normal exit from the autovac launcher. */ static void -AutoVacLauncherShutdown() +AutoVacLauncherShutdown(void) { ereport(DEBUG1, (errmsg("autovacuum launcher shutting down"))); diff --git a/src/backend/storage/buffer/freelist.c b/src/backend/storage/buffer/freelist.c index aa5539a2e45..942f8d4edd2 100644 --- a/src/backend/storage/buffer/freelist.c +++ b/src/backend/storage/buffer/freelist.c @@ -177,7 +177,7 @@ ClockSweepTick(void) * should not call this. */ bool -have_free_buffer() +have_free_buffer(void) { if (StrategyControl->firstFreeBuffer >= 0) return true; diff --git a/src/backend/utils/adt/jsonpath_scan.l b/src/backend/utils/adt/jsonpath_scan.l index be0a2cfa2f7..df56a268d62 100644 --- a/src/backend/utils/adt/jsonpath_scan.l +++ b/src/backend/utils/adt/jsonpath_scan.l @@ -330,7 +330,7 @@ static const JsonPathKeyword keywords[] = { /* Check if current scanstring value is a keyword */ static enum yytokentype -checkKeyword() +checkKeyword(void) { int res = IDENT_P; int diff; diff --git a/src/backend/utils/misc/queryenvironment.c b/src/backend/utils/misc/queryenvironment.c index c0b85ed0b36..31de81f353e 100644 --- a/src/backend/utils/misc/queryenvironment.c +++ b/src/backend/utils/misc/queryenvironment.c @@ -36,7 +36,7 @@ struct QueryEnvironment QueryEnvironment * -create_queryEnv() +create_queryEnv(void) { return (QueryEnvironment *) palloc0(sizeof(QueryEnvironment)); } diff --git a/src/interfaces/libpq/fe-misc.c b/src/interfaces/libpq/fe-misc.c index 19729f96311..9afa0533a62 100644 --- a/src/interfaces/libpq/fe-misc.c +++ b/src/interfaces/libpq/fe-misc.c @@ -1250,7 +1250,7 @@ PQenv2encoding(void) #ifdef ENABLE_NLS static void -libpq_binddomain() +libpq_binddomain(void) { static bool already_bound = false; diff --git a/configure b/configure index 83abe872aa6..b5bd3b2e9c0 100755 --- a/configure +++ b/configure @@ -5321,6 +5321,47 @@ if test x"$pgac_cv_prog_CC_cflags__Wdeclaration_after_statement" = x"yes"; then fi + # Not applicable for C++ + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wold-style-definition, for CFLAGS" >&5 +$as_echo_n "checking whether ${CC} supports -Wold-style-definition, for CFLAGS... " >&6; } +if ${pgac_cv_prog_CC_cflags__Wold_style_definition+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +pgac_save_CC=$CC +CC=${CC} +CFLAGS="${CFLAGS} -Wold-style-definition" +ac_save_c_werror_flag=$ac_c_werror_flag +ac_c_werror_flag=yes +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_c_try_compile "$LINENO"; then : + pgac_cv_prog_CC_cflags__Wold_style_definition=yes +else + pgac_cv_prog_CC_cflags__Wold_style_definition=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_c_werror_flag=$ac_save_c_werror_flag +CFLAGS="$pgac_save_CFLAGS" +CC="$pgac_save_CC" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CC_cflags__Wold_style_definition" >&5 +$as_echo "$pgac_cv_prog_CC_cflags__Wold_style_definition" >&6; } +if test x"$pgac_cv_prog_CC_cflags__Wold_style_definition" = x"yes"; then + CFLAGS="${CFLAGS} -Wold-style-definition" +fi + + # -Wdeclaration-after-statement isn't applicable for C++. Specific C files # disable it, so AC_SUBST the negative form. PERMIT_DECLARATION_AFTER_STATEMENT= diff --git a/configure.in b/configure.in index ecdf1723967..2b0a88ab911 100644 --- a/configure.in +++ b/configure.in @@ -482,6 +482,8 @@ if test "$GCC" = yes -a "$ICC" = no; then # These work in some but not all gcc versions save_CFLAGS=$CFLAGS PGAC_PROG_CC_CFLAGS_OPT([-Wdeclaration-after-statement]) + # Not applicable for C++ + PGAC_PROG_CC_CFLAGS_OPT([-Wold-style-definition]) # -Wdeclaration-after-statement isn't applicable for C++. Specific C files # disable it, so AC_SUBST the negative form. PERMIT_DECLARATION_AFTER_STATEMENT= -- 2.25.0.114.g5b0ca878e0 --zqfhnontb2zb7pps-- ^ permalink raw reply [nested|flat] 3+ messages in thread
* [PATCH] check kernel version for io_method @ 2026-01-13 22:05 Pierre <[email protected]> 0 siblings, 1 reply; 3+ messages in thread From: Pierre @ 2026-01-13 22:05 UTC (permalink / raw) To: [email protected] Hello, Please find a patch proposal for bug BUG #19369: Not documented that io_uring on kernel versions between 5.1 and below 5.6 does not work. This is not a document patch but code patch using a GUC hook to : - check liburing setup - check kernel version to allow/disallow io_method=io_uring I have made successfull tests on: - Alma Linux 9.7/ kernel 5.14 without liburing setup - Debian 12 / kernel 6.1 with liburing-dev NB: This is my first patch and I apologize if it is not fully compliant with patching rules. Thanks. Attachments: [text/x-patch] 0001-patch-check-kernel-version-for-io_method.patch (2.7K, ../../[email protected]/2-0001-patch-check-kernel-version-for-io_method.patch) download | inline diff: From 8e0bd6948f7a75472891965b126356903934dfd2 Mon Sep 17 00:00:00 2001 From: Pierre Forstmann <[email protected]> Date: Tue, 13 Jan 2026 22:53:03 +0100 Subject: [PATCH] patch: check kernel version for io_method --- src/backend/storage/aio/aio.c | 47 +++++++++++++++++++++++ src/backend/utils/misc/guc_parameters.dat | 1 + src/include/utils/guc_hooks.h | 2 + 3 files changed, 50 insertions(+) diff --git a/src/backend/storage/aio/aio.c b/src/backend/storage/aio/aio.c index d2c9cd6f20a..f7610498467 100644 --- a/src/backend/storage/aio/aio.c +++ b/src/backend/storage/aio/aio.c @@ -50,6 +50,7 @@ #include "utils/resowner.h" #include "utils/wait_event_types.h" +#include <sys/utsname.h> static inline void pgaio_io_update_state(PgAioHandle *ioh, PgAioHandleState new_state); static void pgaio_io_reclaim(PgAioHandle *ioh); @@ -1346,3 +1347,49 @@ check_io_max_concurrency(int *newval, void **extra, GucSource source) return true; } + + +bool +check_io_method(int *newval, void **extra, GucSource source) +{ +#ifdef IOMETHOD_IO_URING_ENABLED + if (*newval == IOMETHOD_IO_URING) + { + struct utsname uname_buf; + int major; + int minor; + int rc; + + uname(&uname_buf); + rc = sscanf(uname_buf.release, "%d.%d", &major, &minor); + + if (rc == 2 && ((major >= 5 && minor >= 6) || major >= 6)) + { + /* + * OK + */ + } + else + { + GUC_check_errdetail("io_uring requires Linux kernel 5.6 or later."); + return false; + } + } + + return true; +#else + if (*newval == IOMETHOD_WORKER || *newval == IOMETHOD_SYNC) + { + /* + * OK + */ + } + else + { + GUC_check_errdetail("io_uring requires Linux kernel 5.6 or later."); + return false; + } + + return true; +#endif +} diff --git a/src/backend/utils/misc/guc_parameters.dat b/src/backend/utils/misc/guc_parameters.dat index 7c60b125564..2246af79808 100644 --- a/src/backend/utils/misc/guc_parameters.dat +++ b/src/backend/utils/misc/guc_parameters.dat @@ -1339,6 +1339,7 @@ boot_val => 'DEFAULT_IO_METHOD', options => 'io_method_options', assign_hook => 'assign_io_method', + check_hook => 'check_io_method', }, { name => 'io_workers', type => 'int', context => 'PGC_SIGHUP', group => 'RESOURCES_IO', diff --git a/src/include/utils/guc_hooks.h b/src/include/utils/guc_hooks.h index f723668da9e..1c33dff4b55 100644 --- a/src/include/utils/guc_hooks.h +++ b/src/include/utils/guc_hooks.h @@ -176,4 +176,6 @@ extern bool check_synchronized_standby_slots(char **newval, void **extra, GucSource source); extern void assign_synchronized_standby_slots(const char *newval, void *extra); +extern bool check_io_method(int *newval, void **extra, GucSource source); + #endif /* GUC_HOOKS_H */ -- 2.47.3 ^ permalink raw reply [nested|flat] 3+ messages in thread
* Re: [PATCH] check kernel version for io_method @ 2026-01-14 01:07 Andreas Karlsson <[email protected]> parent: Pierre <[email protected]> 0 siblings, 0 replies; 3+ messages in thread From: Andreas Karlsson @ 2026-01-14 01:07 UTC (permalink / raw) To: Pierre <[email protected]>; [email protected] On 1/13/26 11:05 PM, Pierre wrote: > Please find a patch proposal for bug BUG #19369: Not documented that > io_uring on kernel versions between 5.1 and below 5.6 does not work. Wouldn't it make more sense to use io_uring_get_probe_ring() and io_uring_opcode_supported() to actually check for the required opcode? Then if someone uses a Kernel with the required features backported everything will still work. Andreas ^ permalink raw reply [nested|flat] 3+ messages in thread
end of thread, other threads:[~2026-01-14 01:07 UTC | newest] Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2026-01-13 22:05 [PATCH] check kernel version for io_method Pierre <[email protected]> 2026-01-14 01:07 ` Re: [PATCH] check kernel version for io_method Andreas Karlsson <[email protected]>
This inbox is served by agora; see mirroring instructions for how to clone and mirror all data and code used for this inbox