forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit97525bc
committed
Require sizeof(bool) == 1.
The C standard says that sizeof(bool) is implementation-defined, but weknow of no current systems where it is not 1. The last known systemsseem to have been Apple macOS/PowerPC 10.5 and Microsoft Visual C++ 4,both long defunct.PostgreSQL has always required sizeof(bool) == 1 for the definition ofbool that it used, but previously it would define its own type if thesystem-provided bool had a different size. That was liable to causememory layout problems when interacting with system and third-partylibraries on (by now hypothetical) computers with wider _Bool, and nowC23 has introduced a new problem by making bool a built-in datatype(like C++), so the fallback code doesn't even compile. We couldprobably work around that, but then we'd be writing new untested codefor a computer that doesn't exist.Instead, delete the unreachable and C23-uncompilable fallback code, andlet existing static assertions fail if the system-provided bool is toowide. If we ever get a problem report from a real system, then it willbe time to figure out what to do about it in a way that also works onmodern compilers.Note on C++: Previously we avoided including <stdbool.h> or trying todefine a new bool type in headers that might be included by C++ code.These days we might as well just include <stdbool.h> unconditionally:it should be visible to C++11 but do nothing, just as in C23. Wealready include <stdint.h> without C++ guards in c.h, and that fallsunder the same C99-compatibility section of the C++11 standard as<stdbool.h>, so let's remove the guards here too.Reviewed-by: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/3198438.1731895163%40sss.pgh.pa.us1 parent4b03a27 commit97525bc
File tree
11 files changed
+8
-160
lines changed- src
- backend
- jit/llvm
- utils/fmgr
- include
- interfaces/ecpg/include
- pl/plperl
11 files changed
+8
-160
lines changedLines changed: 0 additions & 41 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14958 | 14958 |
| |
14959 | 14959 |
| |
14960 | 14960 |
| |
14961 |
| - | |
14962 |
| - | |
14963 |
| - | |
14964 |
| - | |
14965 |
| - | |
14966 |
| - | |
14967 |
| - | |
14968 |
| - | |
14969 |
| - | |
14970 |
| - | |
14971 |
| - | |
14972 |
| - | |
14973 |
| - | |
14974 |
| - | |
14975 |
| - | |
14976 |
| - | |
14977 |
| - | |
14978 |
| - | |
14979 |
| - | |
14980 |
| - | |
14981 |
| - | |
14982 |
| - | |
14983 |
| - | |
14984 |
| - | |
14985 |
| - | |
14986 |
| - | |
14987 |
| - | |
14988 |
| - | |
14989 |
| - | |
14990 |
| - | |
14991 |
| - | |
14992 |
| - | |
14993 |
| - | |
14994 |
| - | |
14995 |
| - | |
14996 |
| - | |
14997 |
| - | |
14998 |
| - | |
14999 |
| - | |
15000 |
| - | |
15001 |
| - | |
15002 | 14961 |
| |
15003 | 14962 |
| |
15004 | 14963 |
| |
|
Lines changed: 0 additions & 9 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1691 | 1691 |
| |
1692 | 1692 |
| |
1693 | 1693 |
| |
1694 |
| - | |
1695 |
| - | |
1696 |
| - | |
1697 |
| - | |
1698 |
| - | |
1699 |
| - | |
1700 |
| - | |
1701 |
| - | |
1702 |
| - | |
1703 | 1694 |
| |
1704 | 1695 |
| |
1705 | 1696 |
| |
|
Lines changed: 0 additions & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1755 | 1755 |
| |
1756 | 1756 |
| |
1757 | 1757 |
| |
1758 |
| - | |
1759 |
| - | |
1760 |
| - | |
1761 |
| - | |
1762 |
| - | |
1763 |
| - | |
1764 |
| - | |
1765 | 1758 |
| |
1766 | 1759 |
| |
1767 | 1760 |
| |
|
Lines changed: 3 additions & 5 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
117 | 117 |
| |
118 | 118 |
| |
119 | 119 |
| |
120 |
| - | |
121 |
| - | |
122 |
| - | |
123 |
| - | |
124 |
| - | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
125 | 123 |
| |
126 | 124 |
| |
127 | 125 |
| |
|
Lines changed: 0 additions & 10 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
18 | 18 |
| |
19 | 19 |
| |
20 | 20 |
| |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 |
| - | |
31 | 21 |
| |
32 | 22 |
| |
33 | 23 |
| |
|
Lines changed: 2 additions & 28 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
450 | 450 |
| |
451 | 451 |
| |
452 | 452 |
| |
453 |
| - | |
454 |
| - | |
455 |
| - | |
456 |
| - | |
457 |
| - | |
458 |
| - | |
459 |
| - | |
460 |
| - | |
461 |
| - | |
| 453 | + | |
| 454 | + | |
462 | 455 |
| |
463 | 456 |
| |
464 |
| - | |
465 |
| - | |
466 |
| - | |
467 | 457 |
| |
468 |
| - | |
469 |
| - | |
470 |
| - | |
471 |
| - | |
472 |
| - | |
473 |
| - | |
474 |
| - | |
475 |
| - | |
476 |
| - | |
477 |
| - | |
478 |
| - | |
479 |
| - | |
480 |
| - | |
481 |
| - | |
482 |
| - | |
483 |
| - | |
484 | 458 |
| |
485 | 459 |
| |
486 | 460 |
| |
|
Lines changed: 0 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
597 | 597 |
| |
598 | 598 |
| |
599 | 599 |
| |
600 |
| - | |
601 |
| - | |
602 |
| - | |
603 | 600 |
| |
604 | 601 |
| |
605 | 602 |
| |
| |||
630 | 627 |
| |
631 | 628 |
| |
632 | 629 |
| |
633 |
| - | |
634 |
| - | |
635 |
| - | |
636 | 630 |
| |
637 | 631 |
| |
638 | 632 |
| |
|
Lines changed: 0 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
6 | 6 |
| |
7 | 7 |
| |
8 | 8 |
| |
9 |
| - | |
10 |
| - | |
11 |
| - |
Lines changed: 1 addition & 29 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
7 | 7 |
| |
8 | 8 |
| |
9 | 9 |
| |
| 10 | + | |
10 | 11 |
| |
11 | 12 |
| |
12 | 13 |
| |
13 | 14 |
| |
14 | 15 |
| |
15 | 16 |
| |
16 | 17 |
| |
17 |
| - | |
18 |
| - | |
19 |
| - | |
20 |
| - | |
21 |
| - | |
22 |
| - | |
23 |
| - | |
24 |
| - | |
25 |
| - | |
26 |
| - | |
27 |
| - | |
28 |
| - | |
29 |
| - | |
30 |
| - | |
31 |
| - | |
32 |
| - | |
33 |
| - | |
34 |
| - | |
35 |
| - | |
36 |
| - | |
37 |
| - | |
38 |
| - | |
39 |
| - | |
40 |
| - | |
41 |
| - | |
42 |
| - | |
43 |
| - | |
44 |
| - | |
45 |
| - | |
46 | 18 |
| |
47 | 19 |
| |
48 | 20 |
| |
|
Lines changed: 0 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
5 | 5 |
| |
6 | 6 |
| |
7 | 7 |
| |
8 |
| - | |
9 | 8 |
| |
10 | 9 |
| |
11 | 10 |
| |
|
Lines changed: 2 additions & 21 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
72 | 72 |
| |
73 | 73 |
| |
74 | 74 |
| |
75 |
| - | |
76 |
| - | |
77 |
| - | |
78 |
| - | |
79 |
| - | |
80 |
| - | |
| 75 | + | |
| 76 | + | |
81 | 77 |
| |
82 |
| - | |
83 | 78 |
| |
84 |
| - | |
85 | 79 |
| |
86 | 80 |
| |
87 | 81 |
| |
| |||
180 | 174 |
| |
181 | 175 |
| |
182 | 176 |
| |
183 |
| - | |
184 |
| - | |
185 |
| - | |
186 |
| - | |
187 |
| - | |
188 |
| - | |
189 |
| - | |
190 |
| - | |
191 |
| - | |
192 |
| - | |
193 |
| - | |
194 |
| - | |
195 |
| - | |
196 | 177 |
| |
197 | 178 |
| |
198 | 179 |
| |
|
0 commit comments
Comments
(0)