public inbox for [email protected]help / color / mirror / Atom feed
[PATCH 6/8] Default to LZ4.. 4+ messages / 3 participants [nested] [flat]
* [PATCH 6/8] Default to LZ4.. @ 2021-03-12 21:35 Justin Pryzby <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Justin Pryzby @ 2021-03-12 21:35 UTC (permalink / raw) this is meant to exercise in the CIs, and not meant to be merged --- configure | 6 ++++-- configure.ac | 4 ++-- src/backend/utils/misc/guc.c | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/configure b/configure index 9b590eb432..3afa1e87e3 100755 --- a/configure +++ b/configure @@ -1575,7 +1575,7 @@ Optional Packages: --with-system-tzdata=DIR use system time zone data in DIR --without-zlib do not use Zlib - --with-lz4 build with LZ4 support + --without-lz4 build without LZ4 support --with-gnu-ld assume the C compiler uses GNU ld [default=no] --with-ssl=LIB use LIB for SSL/TLS support (openssl) --with-openssl obsolete spelling of --with-ssl=openssl @@ -8598,7 +8598,9 @@ $as_echo "#define USE_LZ4 1" >>confdefs.h esac else - with_lz4=no + with_lz4=yes + +$as_echo "#define USE_LZ4 1" >>confdefs.h fi diff --git a/configure.ac b/configure.ac index 2b3b5676eb..d62ea5f742 100644 --- a/configure.ac +++ b/configure.ac @@ -990,8 +990,8 @@ AC_SUBST(with_zlib) # LZ4 # AC_MSG_CHECKING([whether to build with LZ4 support]) -PGAC_ARG_BOOL(with, lz4, no, [build with LZ4 support], - [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build with LZ4 support. (--with-lz4)])]) +PGAC_ARG_BOOL(with, lz4, yes, [build without LZ4 support], + [AC_DEFINE([USE_LZ4], 1, [Define to 1 to build without LZ4 support. (--without-lz4)])]) AC_MSG_RESULT([$with_lz4]) AC_SUBST(with_lz4) diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index c37a8313d3..52f9cd0242 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -4728,7 +4728,7 @@ static struct config_enum ConfigureNamesEnum[] = NULL }, &wal_compression_method, - WAL_COMPRESSION_ZLIB, wal_compression_options, + WAL_COMPRESSION_LZ4, wal_compression_options, NULL, NULL, NULL }, -- 2.17.0 --f0KYrhQ4vYSV2aJu Content-Type: text/x-diff; charset=us-ascii Content-Disposition: attachment; filename="0007-add-wal_compression_method-zstd.patch" ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: meson: Specify -Wformat as a common warning flag for extensions @ 2024-03-12 23:56 Sutou Kouhei <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Sutou Kouhei @ 2024-03-12 23:56 UTC (permalink / raw) To: [email protected]; +Cc: [email protected]; pgsql-hackers Hi, In <[email protected]> "Re: meson: Specify -Wformat as a common warning flag for extensions" on Fri, 08 Mar 2024 10:05:27 -0600, "Tristan Partin" <[email protected]> wrote: > Ok, I figured this out. -Wall implies -Wformat=1. We set warning_level > to 1 in the Meson project() call, which implies -Wall, and set -Wall > in CFLAGS for autoconf. That's the reason we don't get issues building > Postgres. A user making use of the pg_config --cflags option, as Sutou > is, *will* run into the aforementioned issues, since we don't > propogate -Wall into pg_config. > > $ gcc $(pg_config --cflags) -E - < /dev/null > /dev/null > cc1: warning: ‘-Wformat-security’ ignored without ‘-Wformat’ > [-Wformat-security] > $ gcc -Wall $(pg_config --cflags) -E - < /dev/null > /dev/null > (nothing printed) Thanks for explaining this. You're right. This is the reason why we don't need this for PostgreSQL itself but we need this for PostgreSQL extensions. Sorry. I should have explained this in the first e-mail... What should we do to proceed this patch? Thanks, -- kou ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: meson: Specify -Wformat as a common warning flag for extensions @ 2024-03-13 05:43 Tristan Partin <[email protected]> parent: Sutou Kouhei <[email protected]> 0 siblings, 1 reply; 4+ messages in thread From: Tristan Partin @ 2024-03-13 05:43 UTC (permalink / raw) To: Sutou Kouhei <[email protected]>; +Cc: [email protected]; pgsql-hackers On Tue Mar 12, 2024 at 6:56 PM CDT, Sutou Kouhei wrote: > Hi, > > In <[email protected]> > "Re: meson: Specify -Wformat as a common warning flag for extensions" on Fri, 08 Mar 2024 10:05:27 -0600, > "Tristan Partin" <[email protected]> wrote: > > > Ok, I figured this out. -Wall implies -Wformat=1. We set warning_level > > to 1 in the Meson project() call, which implies -Wall, and set -Wall > > in CFLAGS for autoconf. That's the reason we don't get issues building > > Postgres. A user making use of the pg_config --cflags option, as Sutou > > is, *will* run into the aforementioned issues, since we don't > > propogate -Wall into pg_config. > > > > $ gcc $(pg_config --cflags) -E - < /dev/null > /dev/null > > cc1: warning: ‘-Wformat-security’ ignored without ‘-Wformat’ > > [-Wformat-security] > > $ gcc -Wall $(pg_config --cflags) -E - < /dev/null > /dev/null > > (nothing printed) > > Thanks for explaining this. You're right. This is the reason > why we don't need this for PostgreSQL itself but we need > this for PostgreSQL extensions. Sorry. I should have > explained this in the first e-mail... > > > What should we do to proceed this patch? Perhaps adding some more clarification in the comments that I wrote. - # -Wformat-security requires -Wformat, so check for it + # -Wformat-secuirty requires -Wformat. We compile with -Wall in + # Postgres, which includes -Wformat=1. -Wformat is shorthand for + # -Wformat=1. The set of flags which includes -Wformat-security is + # persisted into pg_config --cflags, which is commonly used by + # PGXS-based extensions. The lack of -Wformat in the persisted flags + # will produce a warning on many GCC versions, so even though adding + # -Wformat here is a no-op for Postgres, it silences other use cases. That might be too long-winded though :). -- Tristan Partin Neon (https://neon.tech) ^ permalink raw reply [nested|flat] 4+ messages in thread
* Re: meson: Specify -Wformat as a common warning flag for extensions @ 2024-03-13 07:12 Sutou Kouhei <[email protected]> parent: Tristan Partin <[email protected]> 0 siblings, 0 replies; 4+ messages in thread From: Sutou Kouhei @ 2024-03-13 07:12 UTC (permalink / raw) To: [email protected]; +Cc: [email protected]; pgsql-hackers Hi, In <[email protected]> "Re: meson: Specify -Wformat as a common warning flag for extensions" on Wed, 13 Mar 2024 00:43:11 -0500, "Tristan Partin" <[email protected]> wrote: > Perhaps adding some more clarification in the comments that I wrote. > > - # -Wformat-security requires -Wformat, so check for it > + # -Wformat-secuirty requires -Wformat. We compile with -Wall in + # > Postgres, which includes -Wformat=1. -Wformat is shorthand for + # > -Wformat=1. The set of flags which includes -Wformat-security is + # > persisted into pg_config --cflags, which is commonly used by + # > PGXS-based extensions. The lack of -Wformat in the persisted flags > + # will produce a warning on many GCC versions, so even though adding > + # -Wformat here is a no-op for Postgres, it silences other use > cases. > > That might be too long-winded though :). Thanks for the wording! I used it for the v3 patch. Thanks, -- kou Attachments: [text/x-patch] v3-0001-Add-Wformat-to-common-warning-flags.patch (6.4K, ../../[email protected]/2-v3-0001-Add-Wformat-to-common-warning-flags.patch) download | inline diff: From 0ba2e6dd55b00ee8a57313a629a1e5fa8c9e40cc Mon Sep 17 00:00:00 2001 From: Sutou Kouhei <[email protected]> Date: Wed, 13 Mar 2024 16:10:34 +0900 Subject: [PATCH v3] Add -Wformat to common warning flags We specify -Wformat-security as a common warning flag explicitly. GCC requires -Wformat to be added for -Wformat-security to take effect. If -Wformat-security is used without -Wformat, GCC shows the following warning: cc1: warning: '-Wformat-security' ignored without '-Wformat' [-Wformat-security] Note that this is not needed for PostgreSQL itself because PostgreSQL uses -Wall, which includes -Wformat=1. -Wformat is shorthand for -Wformat=1. These flags without -Wall are persisted into "pg_config --cflags", which is commonly used by PGXS-based extensions. So PGXS-based extensions will get the warning without -Wformat. Co-authored-by: Tristan Partin <[email protected]> --- configure | 99 ++++++++++++++++++++++++++++++++++++++++++++++++++++ configure.ac | 10 ++++++ meson.build | 9 +++++ 3 files changed, 118 insertions(+) diff --git a/configure b/configure index 70a1968003..7b0fda3825 100755 --- a/configure +++ b/configure @@ -6013,6 +6013,105 @@ if test x"$pgac_cv_prog_CXX_cxxflags__Wshadow_compatible_local" = x"yes"; then fi + # -Wformat-security requires -Wformat. We compile with -Wall in + # PostgreSQL, which includes -Wformat=1. -Wformat is shorthand for + # -Wformat=1. The set of flags which includes -Wformat-security is + # persisted into pg_config --cflags, which is commonly used by + # PGXS-based extensions. The lack of -Wformat in the persisted flags + # will produce a warning on many GCC versions, so even though adding + # -Wformat here is a no-op for PostgreSQL, it silences other use + # cases., so check for it. + +{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat, for CFLAGS" >&5 +$as_echo_n "checking whether ${CC} supports -Wformat, for CFLAGS... " >&6; } +if ${pgac_cv_prog_CC_cflags__Wformat+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CFLAGS=$CFLAGS +pgac_save_CC=$CC +CC=${CC} +CFLAGS="${CFLAGS} -Wformat" +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__Wformat=yes +else + pgac_cv_prog_CC_cflags__Wformat=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__Wformat" >&5 +$as_echo "$pgac_cv_prog_CC_cflags__Wformat" >&6; } +if test x"$pgac_cv_prog_CC_cflags__Wformat" = x"yes"; then + CFLAGS="${CFLAGS} -Wformat" +fi + + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CXX} supports -Wformat, for CXXFLAGS" >&5 +$as_echo_n "checking whether ${CXX} supports -Wformat, for CXXFLAGS... " >&6; } +if ${pgac_cv_prog_CXX_cxxflags__Wformat+:} false; then : + $as_echo_n "(cached) " >&6 +else + pgac_save_CXXFLAGS=$CXXFLAGS +pgac_save_CXX=$CXX +CXX=${CXX} +CXXFLAGS="${CXXFLAGS} -Wformat" +ac_save_cxx_werror_flag=$ac_cxx_werror_flag +ac_cxx_werror_flag=yes +ac_ext=cpp +ac_cpp='$CXXCPP $CPPFLAGS' +ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_cxx_compiler_gnu + +cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ + +int +main () +{ + + ; + return 0; +} +_ACEOF +if ac_fn_cxx_try_compile "$LINENO"; then : + pgac_cv_prog_CXX_cxxflags__Wformat=yes +else + pgac_cv_prog_CXX_cxxflags__Wformat=no +fi +rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext +ac_ext=c +ac_cpp='$CPP $CPPFLAGS' +ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5' +ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5' +ac_compiler_gnu=$ac_cv_c_compiler_gnu + +ac_cxx_werror_flag=$ac_save_cxx_werror_flag +CXXFLAGS="$pgac_save_CXXFLAGS" +CXX="$pgac_save_CXX" +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $pgac_cv_prog_CXX_cxxflags__Wformat" >&5 +$as_echo "$pgac_cv_prog_CXX_cxxflags__Wformat" >&6; } +if test x"$pgac_cv_prog_CXX_cxxflags__Wformat" = x"yes"; then + CXXFLAGS="${CXXFLAGS} -Wformat" +fi + + # This was included in -Wall/-Wformat in older GCC versions { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${CC} supports -Wformat-security, for CFLAGS" >&5 diff --git a/configure.ac b/configure.ac index 52fd7af446..e4776b9963 100644 --- a/configure.ac +++ b/configure.ac @@ -533,6 +533,16 @@ if test "$GCC" = yes -a "$ICC" = no; then PGAC_PROG_CXX_CFLAGS_OPT([-Wcast-function-type]) PGAC_PROG_CC_CFLAGS_OPT([-Wshadow=compatible-local]) PGAC_PROG_CXX_CFLAGS_OPT([-Wshadow=compatible-local]) + # -Wformat-security requires -Wformat. We compile with -Wall in + # PostgreSQL, which includes -Wformat=1. -Wformat is shorthand for + # -Wformat=1. The set of flags which includes -Wformat-security is + # persisted into pg_config --cflags, which is commonly used by + # PGXS-based extensions. The lack of -Wformat in the persisted flags + # will produce a warning on many GCC versions, so even though adding + # -Wformat here is a no-op for PostgreSQL, it silences other use + # cases., so check for it. + PGAC_PROG_CC_CFLAGS_OPT([-Wformat]) + PGAC_PROG_CXX_CFLAGS_OPT([-Wformat]) # This was included in -Wall/-Wformat in older GCC versions PGAC_PROG_CC_CFLAGS_OPT([-Wformat-security]) PGAC_PROG_CXX_CFLAGS_OPT([-Wformat-security]) diff --git a/meson.build b/meson.build index 55184db248..732cb59b1f 100644 --- a/meson.build +++ b/meson.build @@ -1822,6 +1822,15 @@ common_warning_flags = [ '-Wimplicit-fallthrough=3', '-Wcast-function-type', '-Wshadow=compatible-local', + # -Wformat-security requires -Wformat. We compile with -Wall in + # PostgreSQL, which includes -Wformat=1. -Wformat is shorthand for + # -Wformat=1. The set of flags which includes -Wformat-security is + # persisted into pg_config --cflags, which is commonly used by + # PGXS-based extensions. The lack of -Wformat in the persisted flags + # will produce a warning on many GCC versions, so even though adding + # -Wformat here is a no-op for PostgreSQL, it silences other use + # cases., so check for it. + '-Wformat', # This was included in -Wall/-Wformat in older GCC versions '-Wformat-security', ] -- 2.43.0 ^ permalink raw reply [nested|flat] 4+ messages in thread
end of thread, other threads:[~2024-03-13 07:12 UTC | newest] Thread overview: 4+ messages (download: mbox mbox.gz follow: Atom feed) -- links below jump to the message on this page -- 2021-03-12 21:35 [PATCH 6/8] Default to LZ4.. Justin Pryzby <[email protected]> 2024-03-12 23:56 Re: meson: Specify -Wformat as a common warning flag for extensions Sutou Kouhei <[email protected]> 2024-03-13 05:43 ` Re: meson: Specify -Wformat as a common warning flag for extensions Tristan Partin <[email protected]> 2024-03-13 07:12 ` Re: meson: Specify -Wformat as a common warning flag for extensions Sutou Kouhei <[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