Commit 3a0f8e7
committed
Make [U]INT64CONST safe for use in #if conditions.
Instead of using a cast to force the constant to be the right width,
assume we can plaster on an L, UL, LL, or ULL suffix as appropriate.
The old approach to this is very hoary, dating from before we were
willing to require compilers to have working int64 types.
This fix makes the PG_INT64_MIN, PG_INT64_MAX, and PG_UINT64_MAX
constants safe to use in preprocessor conditions, where a cast
doesn't work. Other symbolic constants that might be defined using
[U]INT64CONST are likewise safer than before.
Also fix the SIZE_MAX macro to be similarly safe, if we are forced
to provide a definition for that. The test added in commit 2e70d6b
happens to do what we want even with the hack "(size_t) -1" definition,
but we could easily get burnt on other tests in future.
Back-patch to all supported branches, like the previous commits.
Discussion: https://postgr.es/m/15883.1504278595@sss.pgh.pa.us1 parent e50d401 commit 3a0f8e7
File tree
5 files changed
+11
-52
lines changed- src/include
5 files changed
+11
-52
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
13726 | 13726 | | |
13727 | 13727 | | |
13728 | 13728 | | |
13729 | | - | |
13730 | | - | |
13731 | | - | |
13732 | | - | |
13733 | | - | |
13734 | | - | |
13735 | | - | |
13736 | | - | |
13737 | | - | |
13738 | | - | |
13739 | | - | |
13740 | | - | |
13741 | | - | |
13742 | | - | |
13743 | | - | |
13744 | | - | |
13745 | | - | |
13746 | | - | |
13747 | 13729 | | |
13748 | 13730 | | |
13749 | 13731 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1751 | 1751 | | |
1752 | 1752 | | |
1753 | 1753 | | |
1754 | | - | |
1755 | | - | |
1756 | | - | |
1757 | | - | |
1758 | | - | |
1759 | | - | |
1760 | | - | |
1761 | | - | |
1762 | | - | |
1763 | | - | |
1764 | | - | |
1765 | | - | |
1766 | 1754 | | |
1767 | 1755 | | |
1768 | 1756 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
285 | 285 | | |
286 | 286 | | |
287 | 287 | | |
| 288 | + | |
| 289 | + | |
288 | 290 | | |
289 | 291 | | |
290 | 292 | | |
| |||
294 | 296 | | |
295 | 297 | | |
296 | 298 | | |
| 299 | + | |
| 300 | + | |
297 | 301 | | |
298 | 302 | | |
299 | 303 | | |
300 | 304 | | |
301 | 305 | | |
302 | | - | |
303 | | - | |
304 | | - | |
305 | | - | |
306 | | - | |
307 | | - | |
308 | | - | |
309 | | - | |
310 | | - | |
311 | 306 | | |
312 | 307 | | |
313 | 308 | | |
| |||
335 | 330 | | |
336 | 331 | | |
337 | 332 | | |
338 | | - | |
| 333 | + | |
339 | 334 | | |
340 | 335 | | |
341 | 336 | | |
342 | 337 | | |
343 | 338 | | |
344 | 339 | | |
345 | | - | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
346 | 345 | | |
347 | 346 | | |
348 | 347 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
333 | 333 | | |
334 | 334 | | |
335 | 335 | | |
336 | | - | |
337 | | - | |
338 | | - | |
339 | | - | |
340 | 336 | | |
341 | 337 | | |
342 | 338 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
217 | 217 | | |
218 | 218 | | |
219 | 219 | | |
220 | | - | |
221 | | - | |
222 | | - | |
223 | | - | |
224 | | - | |
225 | | - | |
226 | 220 | | |
227 | 221 | | |
228 | 222 | | |
| |||
231 | 225 | | |
232 | 226 | | |
233 | 227 | | |
234 | | - | |
| 228 | + | |
235 | 229 | | |
236 | 230 | | |
237 | 231 | | |
| |||
0 commit comments