- Notifications
You must be signed in to change notification settings - Fork4.9k
Commit9bc2d37
committed
Make our usage of memset_s() conform strictly to the C11 standard.
Per the letter of the C11 standard, one must #define__STDC_WANT_LIB_EXT1__ as 1 before including <string.h> in order tohave access to memset_s(). It appears that many platforms are lenientabout this, because we weren't doing it and yet the code appeared towork anyway. But we now find that with -std=c11, macOS is strict anddoesn't declare memset_s, leading to compile failures since we try touse it anyway. (Given the lack of prior reports, perhaps this is newbehavior in the latest SDK? No matter, we're clearly in the wrong.)In addition to the immediate problem, which could be fixed merely byadding the needed #define to explicit_bzero.c, it seems possible thatour configure-time probe for memset_s() could fail in case a platformimplements the function in some odd way due to this spec requirement.This concern can be fixed in largely the same way that we dealt withstrchrnul() in6da2ba1: switch to using a declaration-basedconfigure probe instead of a does-it-link probe.Back-patch to v13 where we started using memset_s().Reported-by: Lakshmi Narayana Velayudam <dev.narayana.v@gmail.com>Author: Tom Lane <tgl@sss.pgh.pa.us>Discussion:https://postgr.es/m/CAA4pTnLcKGG78xeOjiBr5yS7ZeE-Rh=FaFQQGOO=nPzA1L8yEA@mail.gmail.comBackpatch-through: 131 parent24d3903 commit9bc2d37
File tree
5 files changed
+24
-7
lines changed- src
- include
- port
- tools/msvc
5 files changed
+24
-7
lines changedLines changed: 14 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
15789 | 15789 |
| |
15790 | 15790 |
| |
15791 | 15791 |
| |
15792 |
| - | |
| 15792 | + | |
15793 | 15793 |
| |
15794 | 15794 |
| |
15795 | 15795 |
| |
| |||
16321 | 16321 |
| |
16322 | 16322 |
| |
16323 | 16323 |
| |
| 16324 | + | |
| 16325 | + | |
| 16326 | + | |
| 16327 | + | |
| 16328 | + | |
| 16329 | + | |
| 16330 | + | |
| 16331 | + | |
| 16332 | + | |
| 16333 | + | |
| 16334 | + | |
| 16335 | + | |
| 16336 | + | |
16324 | 16337 |
| |
16325 | 16338 |
| |
16326 | 16339 |
| |
|
Lines changed: 2 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1750 | 1750 |
| |
1751 | 1751 |
| |
1752 | 1752 |
| |
1753 |
| - | |
1754 | 1753 |
| |
1755 | 1754 |
| |
1756 | 1755 |
| |
| |||
1799 | 1798 |
| |
1800 | 1799 |
| |
1801 | 1800 |
| |
| 1801 | + | |
| 1802 | + | |
1802 | 1803 |
| |
1803 | 1804 |
| |
1804 | 1805 |
| |
|
Lines changed: 4 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
135 | 135 |
| |
136 | 136 |
| |
137 | 137 |
| |
| 138 | + | |
| 139 | + | |
| 140 | + | |
| 141 | + | |
138 | 142 |
| |
139 | 143 |
| |
140 | 144 |
| |
| |||
365 | 369 |
| |
366 | 370 |
| |
367 | 371 |
| |
368 |
| - | |
369 |
| - | |
370 |
| - | |
371 | 372 |
| |
372 | 373 |
| |
373 | 374 |
| |
|
Lines changed: 3 additions & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
12 | 12 |
| |
13 | 13 |
| |
14 | 14 |
| |
| 15 | + | |
| 16 | + | |
15 | 17 |
| |
16 | 18 |
| |
17 |
| - | |
| 19 | + | |
18 | 20 |
| |
19 | 21 |
| |
20 | 22 |
| |
|
Lines changed: 1 addition & 1 deletion
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
240 | 240 |
| |
241 | 241 |
| |
242 | 242 |
| |
| 243 | + | |
243 | 244 |
| |
244 | 245 |
| |
245 | 246 |
| |
| |||
313 | 314 |
| |
314 | 315 |
| |
315 | 316 |
| |
316 |
| - | |
317 | 317 |
| |
318 | 318 |
| |
319 | 319 |
| |
|
0 commit comments
Comments
(0)