Skip to content

Commit b225c5e

Browse files
committed
Remove circular #include's between wait_event.h and wait_event_types.h
wait_event_types.h is generated by the code, and included wait_event.h. wait_event.h did the opposite move, including wait_event_types.h, causing a circular dependency between both. wait_event_types.h only needs to now about the wait event classes, so this information is moved into its own file, and wait_event_types.h uses this new header so as it does not depend anymore on wait_event.h. Note that such errors can be found with clang-tidy, with commands like this one: clang-tidy source_file.c --checks=misc-header-include-cycle -- \ -I/install/path/include/ -I/install/path/include/server/ Issue introduced by fa88928. Author: Bertrand Drouvot <bertranddrouvot.pg@gmail.com> Discussion: https://postgr.es/m/350192.1745768770@sss.pgh.pa.us
1 parent 1aa7cf9 commit b225c5e

File tree

3 files changed

+30
-17
lines changed

3 files changed

+30
-17
lines changed

src/backend/utils/activity/generate-wait_event_types.pl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@
168168
printf $h $header_comment, 'wait_event_types.h';
169169
printf $h "#ifndef WAIT_EVENT_TYPES_H\n";
170170
printf $h "#define WAIT_EVENT_TYPES_H\n\n";
171-
printf $h "#include \"utils/wait_event.h\"\n\n";
171+
printf $h "#include \"utils/wait_classes.h\"\n\n";
172172

173173
printf $c $header_comment, 'pgstat_wait_event.c';
174174

src/include/utils/wait_classes.h

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
/*-------------------------------------------------------------------------
2+
* wait_classes.h
3+
* Definitions related to wait event classes
4+
*
5+
* Copyright (c) 2001-2025, PostgreSQL Global Development Group
6+
*
7+
* src/include/utils/wait_classes.h
8+
* ----------
9+
*/
10+
#ifndef WAIT_CLASSES_H
11+
#define WAIT_CLASSES_H
12+
13+
14+
/* ----------
15+
* Wait Classes
16+
* ----------
17+
*/
18+
#define PG_WAIT_LWLOCK 0x01000000U
19+
#define PG_WAIT_LOCK 0x03000000U
20+
#define PG_WAIT_BUFFERPIN 0x04000000U
21+
#define PG_WAIT_ACTIVITY 0x05000000U
22+
#define PG_WAIT_CLIENT 0x06000000U
23+
#define PG_WAIT_EXTENSION 0x07000000U
24+
#define PG_WAIT_IPC 0x08000000U
25+
#define PG_WAIT_TIMEOUT 0x09000000U
26+
#define PG_WAIT_IO 0x0A000000U
27+
#define PG_WAIT_INJECTIONPOINT 0x0B000000U
28+
29+
#endif /* WAIT_CLASSES_H */

src/include/utils/wait_event.h

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,6 @@
1010
#ifndef WAIT_EVENT_H
1111
#define WAIT_EVENT_H
1212

13-
14-
/* ----------
15-
* Wait Classes
16-
* ----------
17-
*/
18-
#define PG_WAIT_LWLOCK 0x01000000U
19-
#define PG_WAIT_LOCK 0x03000000U
20-
#define PG_WAIT_BUFFERPIN 0x04000000U
21-
#define PG_WAIT_ACTIVITY 0x05000000U
22-
#define PG_WAIT_CLIENT 0x06000000U
23-
#define PG_WAIT_EXTENSION 0x07000000U
24-
#define PG_WAIT_IPC 0x08000000U
25-
#define PG_WAIT_TIMEOUT 0x09000000U
26-
#define PG_WAIT_IO 0x0A000000U
27-
#define PG_WAIT_INJECTIONPOINT 0x0B000000U
28-
2913
/* enums for wait events */
3014
#include "utils/wait_event_types.h"
3115

0 commit comments

Comments
 (0)