Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitd6b059e

Browse files
committed
Document intentional violations of header inclusion policy.
Although there are good reasons for our policy of including postgres.has the first #include in every .c file, never from .h files, there aretwo places where it seems expedient to violate the policy because thealternative is to modify externally-supplied .c files. (In the caseof the regexp library, the idea that it's externally-supplied is kindof at odds with reality, but I haven't entirely given up hope that itwill become a standalone project some day.) Add some comments to makeit explicit that this is a policy violation and provide the reasoning.In passing, move #include "miscadmin.h" out of regcomp.c and intoregcustom.h, which is where it should be if we're taking this reasoningseriously at all.Discussion:https://postgr.es/m/CAEepm=2zCoeq3QxVwhS5DFeUh=yU6z81pbWMgfOB8OzyiBwxzw@mail.gmail.comDiscussion:https://postgr.es/m/11634.1488932128@sss.pgh.pa.us
1 parent2f899e7 commitd6b059e

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

‎src/backend/regex/regcomp.c

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

3535
#include"regex/regguts.h"
3636

37-
#include"miscadmin.h"/* needed by rcancelrequested/rstacktoodeep */
38-
3937
/*
4038
* forward declarations, up here so forward datatypes etc. are defined early
4139
*/

‎src/include/regex/regcustom.h

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@
2929
*/
3030

3131
/* headers if any */
32+
33+
/*
34+
* It's against Postgres coding conventions to include postgres.h in a
35+
* header file, but we allow the violation here because the regexp library
36+
* files specifically intend this file to supply application-dependent
37+
* headers, and are careful to include this file before anything else.
38+
*/
3239
#include"postgres.h"
3340

3441
#include<ctype.h>
@@ -47,6 +54,8 @@
4754

4855
#include"mb/pg_wchar.h"
4956

57+
#include"miscadmin.h"/* needed by rcancelrequested/rstacktoodeep */
58+
5059

5160
/* overrides for regguts.h definitions, if any */
5261
#defineFUNCPTR(name,args) (*name) args

‎src/include/snowball/header.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,11 @@
2222
#ifndefSNOWBALL_HEADR_H
2323
#defineSNOWBALL_HEADR_H
2424

25+
/*
26+
* It's against Postgres coding conventions to include postgres.h in a
27+
* header file, but we allow the violation here because the alternative is
28+
* to modify the machine-generated .c files provided by the Snowball project.
29+
*/
2530
#include"postgres.h"
2631

2732
/* Some platforms define MAXINT and/or MININT, causing conflicts */

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp