forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commitf2fe1cb
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 werewilling to require compilers to have working int64 types.This fix makes the PG_INT64_MIN, PG_INT64_MAX, and PG_UINT64_MAXconstants safe to use in preprocessor conditions, where a castdoesn'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 forcedto provide a definition for that. The test added in commit2e70d6bhappens 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 parentcbb51eb commitf2fe1cb
File tree
5 files changed
+11
-52
lines changed- src/include
5 files changed
+11
-52
lines changedLines changed: 0 additions & 18 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
14254 | 14254 |
| |
14255 | 14255 |
| |
14256 | 14256 |
| |
14257 |
| - | |
14258 |
| - | |
14259 |
| - | |
14260 |
| - | |
14261 |
| - | |
14262 |
| - | |
14263 |
| - | |
14264 |
| - | |
14265 |
| - | |
14266 |
| - | |
14267 |
| - | |
14268 |
| - | |
14269 |
| - | |
14270 |
| - | |
14271 |
| - | |
14272 |
| - | |
14273 |
| - | |
14274 |
| - | |
14275 | 14257 |
| |
14276 | 14258 |
| |
14277 | 14259 |
| |
|
Lines changed: 0 additions & 12 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1735 | 1735 |
| |
1736 | 1736 |
| |
1737 | 1737 |
| |
1738 |
| - | |
1739 |
| - | |
1740 |
| - | |
1741 |
| - | |
1742 |
| - | |
1743 |
| - | |
1744 |
| - | |
1745 |
| - | |
1746 |
| - | |
1747 |
| - | |
1748 |
| - | |
1749 |
| - | |
1750 | 1738 |
| |
1751 | 1739 |
| |
1752 | 1740 |
| |
|
Lines changed: 10 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
288 | 288 |
| |
289 | 289 |
| |
290 | 290 |
| |
| 291 | + | |
| 292 | + | |
291 | 293 |
| |
292 | 294 |
| |
293 | 295 |
| |
| |||
297 | 299 |
| |
298 | 300 |
| |
299 | 301 |
| |
| 302 | + | |
| 303 | + | |
300 | 304 |
| |
301 | 305 |
| |
302 | 306 |
| |
303 | 307 |
| |
304 | 308 |
| |
305 |
| - | |
306 |
| - | |
307 |
| - | |
308 |
| - | |
309 |
| - | |
310 |
| - | |
311 |
| - | |
312 |
| - | |
313 |
| - | |
314 | 309 |
| |
315 | 310 |
| |
316 | 311 |
| |
| |||
338 | 333 |
| |
339 | 334 |
| |
340 | 335 |
| |
341 |
| - | |
| 336 | + | |
342 | 337 |
| |
343 | 338 |
| |
344 | 339 |
| |
345 | 340 |
| |
346 | 341 |
| |
347 | 342 |
| |
348 |
| - | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
349 | 348 |
| |
350 | 349 |
| |
351 | 350 |
| |
|
Lines changed: 0 additions & 4 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
339 | 339 |
| |
340 | 340 |
| |
341 | 341 |
| |
342 |
| - | |
343 |
| - | |
344 |
| - | |
345 |
| - | |
346 | 342 |
| |
347 | 343 |
| |
348 | 344 |
| |
|
Lines changed: 1 addition & 7 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
223 | 223 |
| |
224 | 224 |
| |
225 | 225 |
| |
226 |
| - | |
227 |
| - | |
228 |
| - | |
229 |
| - | |
230 |
| - | |
231 |
| - | |
232 | 226 |
| |
233 | 227 |
| |
234 | 228 |
| |
| |||
237 | 231 |
| |
238 | 232 |
| |
239 | 233 |
| |
240 |
| - | |
| 234 | + | |
241 | 235 |
| |
242 | 236 |
| |
243 | 237 |
| |
|
0 commit comments
Comments
(0)