Bug#991267: pg_config.h leaks internal macros
On 21.07.21 13:51, Max Kellermann wrote: On 2021/07/21 13:42, Peter Eisentraut wrote: What specifically are you trying to check for in libpq? Maybe there is a better way, or we could add one. It's about this compile-time check: https://github.com/CM4all/libcommon/blob/master/src/pg/Connection.hxx#L430 This is a C++ wrapper for libpq, and some users of this library run on very old Debian versions with just libpq 8, and other users run on Debian 11 with libpq wrapped in C++20 Coroutines, and for that they need PQsetSingleRowMode() which is only available since version 9. For more recently added features, libpq has feature macros such as /* Indicates presence of PQenterPipelineMode and friends */ #define LIBPQ_HAS_PIPELINING 1 /* Indicates presence of PQsetTraceFlags; also new PQtrace output format */ #define LIBPQ_HAS_TRACE_FLAGS 1 The feature you are testing arrived in PostgreSQL 9.2, so it's too old to do anything about at this point.
Bug#991267: pg_config.h leaks internal macros
On 2021/07/21 13:42, Peter Eisentraut wrote: > What specifically are you trying to check for in libpq? Maybe there is a > better way, or we could add one. It's about this compile-time check: https://github.com/CM4all/libcommon/blob/master/src/pg/Connection.hxx#L430 This is a C++ wrapper for libpq, and some users of this library run on very old Debian versions with just libpq 8, and other users run on Debian 11 with libpq wrapped in C++20 Coroutines, and for that they need PQsetSingleRowMode() which is only available since version 9.
Bug#991267: pg_config.h leaks internal macros
On 21.07.21 08:51, Max Kellermann wrote: On 2021/07/21 08:44, Peter Eisentraut wrote: pg_config.h should only be included when compiling server-side plugins. Under what circumstances would such a plug-in use OpenSSL directly? Could you explain in more detail what you are trying to do? I did not know that - I use it to check the library version at compile time with PG_VERSION_NUM / PG_MAJORVERSION_NUM to see which features are available. This is about a client using libpq, not a server-side plugin. Obviously, PQlibVersion() is a function that can only be used at runtime, and it's too late then. Other than those macros in pg_config.h, I could not find any other compile-time way to check the libpq version. What specifically are you trying to check for in libpq? Maybe there is a better way, or we could add one.
Bug#991267: pg_config.h leaks internal macros
On 2021/07/21 08:44, Peter Eisentraut wrote: > pg_config.h should only be included when compiling server-side plugins. > Under what circumstances would such a plug-in use OpenSSL directly? Could > you explain in more detail what you are trying to do? I did not know that - I use it to check the library version at compile time with PG_VERSION_NUM / PG_MAJORVERSION_NUM to see which features are available. This is about a client using libpq, not a server-side plugin. Obviously, PQlibVersion() is a function that can only be used at runtime, and it's too late then. Other than those macros in pg_config.h, I could not find any other compile-time way to check the libpq version.
Bug#991267: pg_config.h leaks internal macros
On 19.07.21 11:33, Max Kellermann wrote: Package: libpq-dev Version: 14~beta2-1 pg_config.h is a public header and needed if an application wants to check the version number at compile time. However, in version 14, it leaks a lot of internal PostgreSQL macros, e.g. OPENSSL_API_COMPAT which breaks applications using OpenSSL directly: /usr/include/postgresql/pg_config.h:791:9: error: 'OPENSSL_API_COMPAT' macro redefined [-Werror,-Wmacro-redefined] #define OPENSSL_API_COMPAT 0x10001000L ^ :10:9: note: previous definition is here #define OPENSSL_API_COMPAT 0x1010L ^ pg_config.h should only be included when compiling server-side plugins. Under what circumstances would such a plug-in use OpenSSL directly? Could you explain in more detail what you are trying to do?
Bug#991267: pg_config.h leaks internal macros
Package: libpq-dev Version: 14~beta2-1 pg_config.h is a public header and needed if an application wants to check the version number at compile time. However, in version 14, it leaks a lot of internal PostgreSQL macros, e.g. OPENSSL_API_COMPAT which breaks applications using OpenSSL directly: /usr/include/postgresql/pg_config.h:791:9: error: 'OPENSSL_API_COMPAT' macro redefined [-Werror,-Wmacro-redefined] #define OPENSSL_API_COMPAT 0x10001000L ^ :10:9: note: previous definition is here #define OPENSSL_API_COMPAT 0x1010L ^