Skip to content

Commit 7640f93

Browse files
committed
Fix assorted header files that failed to compile standalone.
We have a longstanding project convention that all .h files should be includable with no prerequisites other than postgres.h. This is tested/relied-on by cpluspluscheck. However, cpluspluscheck has not historically been applied to most headers outside the src/include tree, with the predictable consequence that some of them don't work. Fix that, usually by adding missing #include dependencies. The change in printf_hack.h might require some explanation: without it, my C++ compiler whines that the function is unused. There's not so many call sites that "inline" is going to cost much, and besides all the callers are in test code that we really don't care about the size of. There's no actual bugs being fixed here, so I see no need to back-patch. Discussion: https://postgr.es/m/b517ec3918d645eb950505eac8dd434e@gaz-is.ru
1 parent 9e58705 commit 7640f93

File tree

13 files changed

+27
-2
lines changed

13 files changed

+27
-2
lines changed

src/bin/pg_waldump/rmgrdesc.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#ifndef RMGRDESC_H
99
#define RMGRDESC_H
1010

11+
#include "access/xlogreader.h"
1112
#include "lib/stringinfo.h"
1213

1314
typedef struct RmgrDescData

src/bin/psql/crosstabview.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#ifndef CROSSTABVIEW_H
1010
#define CROSSTABVIEW_H
1111

12+
#include "libpq-fe.h"
13+
1214
/*
1315
* Limit the number of output columns generated in memory by the crosstabview
1416
* algorithm. A new output column is added for each distinct value found in the

src/interfaces/ecpg/ecpglib/ecpglib_extern.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
#include "sqlda-native.h"
99
#include "sqlda-compat.h"
1010
#include "ecpg_config.h"
11+
#include "ecpgtype.h"
1112

1213
#ifndef CHAR_BIT
1314
#include <limits.h>

src/interfaces/ecpg/test/printf_hack.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* print_double(x) has the same effect as printf("%g", x), but is intended
33
* to produce the same formatting across all platforms.
44
*/
5-
static void
5+
static inline void
66
print_double(double x)
77
{
88
#ifdef WIN32

src/interfaces/libpq/fe-gssapi-common.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,13 @@
1616
#include "libpq-fe.h"
1717
#include "libpq-int.h"
1818

19+
#ifdef ENABLE_GSS
20+
1921
void pg_GSS_error(const char *mprefix, PGconn *conn,
2022
OM_uint32 maj_stat, OM_uint32 min_stat);
2123
bool pg_GSS_have_ccache(gss_cred_id_t *cred_out);
2224
int pg_GSS_load_servicename(PGconn *conn);
25+
26+
#endif
27+
2328
#endif /* FE_GSSAPI_COMMON_H */

src/pl/plperl/plperl_helpers.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@
33

44
#include "mb/pg_wchar.h"
55

6+
#include "plperl.h"
7+
8+
69
/*
710
* convert from utf8 to database encoding
811
*

src/pl/plpython/plpy_elog.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
#ifndef PLPY_ELOG_H
66
#define PLPY_ELOG_H
77

8+
#include "plpython.h"
9+
810
/* global exception classes */
911
extern PyObject *PLy_exc_error;
1012
extern PyObject *PLy_exc_fatal;

src/pl/plpython/plpy_resultobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "access/tupdesc.h"
99

10+
#include "plpython.h"
11+
1012

1113
typedef struct PLyResultObject
1214
{

src/pl/plpython/plpy_spi.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77

88
#include "utils/resowner.h"
99

10+
#include "plpython.h"
11+
1012
extern PyObject *PLy_spi_prepare(PyObject *self, PyObject *args);
1113
extern PyObject *PLy_spi_execute(PyObject *self, PyObject *args);
1214
extern PyObject *PLy_spi_execute_plan(PyObject *ob, PyObject *list, long limit);

src/pl/plpython/plpy_subxactobject.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@
88
#include "nodes/pg_list.h"
99
#include "utils/resowner.h"
1010

11+
#include "plpython.h"
12+
1113
/* a list of nested explicit subtransactions */
1214
extern List *explicit_subtransactions;
1315

src/pl/plpython/plpy_typeio.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@
99
#include "fmgr.h"
1010
#include "utils/typcache.h"
1111

12+
#include "plpython.h"
13+
1214
struct PLyProcedure; /* avoid requiring plpy_procedure.h here */
1315

1416

src/pl/plpython/plpy_util.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
#ifndef PLPY_UTIL_H
77
#define PLPY_UTIL_H
88

9+
#include "plpython.h"
10+
911
extern PyObject *PLyUnicode_Bytes(PyObject *unicode);
1012
extern char *PLyUnicode_AsString(PyObject *unicode);
1113

src/pl/plpython/plpython.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@
1414

1515
/*
1616
* Include order should be: postgres.h, other postgres headers, plpython.h,
17-
* other plpython headers
17+
* other plpython headers. (In practice, other plpython headers will also
18+
* include this file, so that they can compile standalone.)
1819
*/
1920
#ifndef POSTGRES_H
2021
#error postgres.h must be included before plpython.h

0 commit comments

Comments
 (0)