Re: Add version macro to libpq-fe.h

From: Alvaro Herrera <alvaro(dot)herrera(at)2ndquadrant(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Boris Kolpackov <boris(at)codesynthesis(dot)com>, pgsql-hackers(at)lists(dot)postgresql(dot)org
Subject: Re: Add version macro to libpq-fe.h
Date: 2021-06-18 18:03:41
Message-ID: 202106181803.7ueuxvqv5jah@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2021-Jun-18, Tom Lane wrote:

> Alvaro Herrera <alvaro(dot)herrera(at)2ndquadrant(dot)com> writes:
> > So I'm +1 on adding this "feature macro".
>
> Concretely, how about the attached?

Seems OK to me. We can just accumulate any similar ones in the future
nearby.

> (I also got rid of a recently-added
> extra comma. While the compilers we use might not warn about that,
> it seems unwise to assume that no user's compiler will.)

Oops.

> I guess one unresolved question is whether we want to mention these in
> the SGML docs. I vote "no", because it'll raise the maintenance cost
> noticeably. But I can see an argument on the other side.

Well, if we do want docs for these macros, then IMO it'd be okay to have
them in libpq-fe.h itself rather than SGML. A one-line comment for each
would suffice:

+/*
+ * These symbols may be used in compile-time #ifdef tests for the availability
+ * of newer libpq features.
+ */
+/* Indicates presence of PQenterPipelineMode and friends */
+#define LIBPQ_HAS_PIPELINING 1
+
+/* Indicates presence of PQsetTraceFlags; PQtrace changed output format */
+#define LIBPQ_HAS_TRACE_FLAGS 1

--
Álvaro Herrera 39°49'30"S 73°17'W

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2021-06-18 18:24:10 Re: Add version macro to libpq-fe.h
Previous Message Tom Lane 2021-06-18 17:44:33 Re: Add version macro to libpq-fe.h