public inbox for [email protected]help / color / mirror / Atom feed
[PATCH] Add -Wold-style-definition to CFLAGS. 21+ messages / 2 participants [nested] [flat]
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* [PATCH] Add -Wold-style-definition to CFLAGS. @ 2020-05-09 17:38 Andres Freund <[email protected]> 0 siblings, 0 replies; 21+ 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] 21+ messages in thread
* Regression tests fail with musl libc because libpq.so can't be loaded @ 2024-03-16 12:38 Wolfgang Walther <[email protected]> 0 siblings, 0 replies; 21+ messages in thread From: Wolfgang Walther @ 2024-03-16 12:38 UTC (permalink / raw) To: PostgreSQL Bugs <[email protected]> Running the regression tests when building with musl libc fails, with errors like the following: ERROR: could not load library "<builddir>/tmp_install/usr/lib/postgresql/libpqwalreceiver.so": Error loading shared library libpq.so.5: No such file or directory (needed by <builddir>/tmp_install/usr/lib/postgresql/libpqwalreceiver.so) This was observed in Alpine Linux [1] and nixpkgs [2] a few years ago. I now looked at this a bit and this is what happens: - The temporary install location is set via LD_LIBRARY_PATH in the regression tests, so that postgres can find those libs. - All tests which load an extension / shared module via dlopen() fail, when the loaded library in turn depends on another library in tmp_install - I think in practice it's libpq.so all the time. - LD_LIBRARY_PATH is used correctly to look for the direct dependency loaded in dlopen(...), but is not taken into account anymore when trying to locate libpq.so. This step only fails with musl, but works fine with glibc. I can reproduce this with a simple Dockerfile (attached), which uses the library/postgres-alpine image, moves libpq.so to a different folder and points LD_LIBRARY_PATH at it. Build and run the dockerfile like this: docker build . -t pg-musl && docker run --rm pg-musl This Dockerfile can easily be adjusted to work with the debian image - which shows that doing the same with glibc works just fine. Even though this originated in "just" the regression tests, I'm filing this as a bug, because: - The docs explicitly mention LD_LIBRARY_PATH support to point at a different /lib folder in [3]. - This can clearly break outside the test-suite as shown with the Dockerfile. I tried a few more things: - When I add an /etc/ld-musl-$(ARCH).path file and add the path to libpq.so's libdir to it, libpq.so can be found. - When I add the path to libpq.so as an rpath to the postgres binary, libpq.so can be found. Both is not surprising, but just confirms musl-ld actually works as expected. It's just LD_LIBRARY_PATH that seems to not be passed on. To rule out a musl bug, I also put together a very simple test-case of an executable loading liba with dlopen(), which depends on libb and then constructing the same scenario with LD_LIBRARY_PATH. This works fine when compiled with glibc and musl, too. Thus, I believe the problem to be somewhere in how postgres loads those libraries. Best, Wolfgang [1]: https://github.com/alpinelinux/aports/commit/d67ceb66a1ca9e1899071c9ef09fffba29fa0417#diff-2bd25b517... [2]: https://github.com/NixOS/nixpkgs/commit/09ffd722072291f00f2a54d7404eb568a15e562a [3]: https://www.postgresql.org/docs/current/install-post.html FROM postgres:16-alpine ENV POSTGRES_HOST_AUTH_METHOD=trust ENV LD_LIBRARY_PATH=/opt/lib RUN mkdir -p /opt/lib && mv /usr/local/lib/libpq.so* /opt/lib # This causes dlopen(libpqwalreceiver.so) COPY <<-EOF /docker-entrypoint-initdb.d/create-subscription.sql CREATE SUBSCRIPTION sub1 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false); EOF Attachments: [text/plain] Dockerfile (369B, ../../[email protected]/2-Dockerfile) download | inline: FROM postgres:16-alpine ENV POSTGRES_HOST_AUTH_METHOD=trust ENV LD_LIBRARY_PATH=/opt/lib RUN mkdir -p /opt/lib && mv /usr/local/lib/libpq.so* /opt/lib # This causes dlopen(libpqwalreceiver.so) COPY <<-EOF /docker-entrypoint-initdb.d/create-subscription.sql CREATE SUBSCRIPTION sub1 CONNECTION 'dbname=doesnotexist' PUBLICATION pub1 WITH (connect = false); EOF ^ permalink raw reply [nested|flat] 21+ messages in thread
end of thread, other threads:[~2024-03-16 12:38 UTC | newest] Thread overview: 21+ 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]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2020-05-09 17:38 [PATCH] Add -Wold-style-definition to CFLAGS. Andres Freund <[email protected]> 2024-03-16 12:38 Regression tests fail with musl libc because libpq.so can't be loaded Wolfgang Walther <[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