forked frompostgres/postgres
- Notifications
You must be signed in to change notification settings - Fork6
Commit728560d
committed
Suppress compiler warnings in new pgstats code.
Some clang versions whine about comparing an enum variable toa value outside the range of the enum, on the grounds that theresult must be constant. In the cases we fix here, the loopswill terminate only if the enum variable can in fact hold avalue one beyond its declared range. While that's very likelyto always be true for these enum types, it still seems like apoor coding practice to assume it; so use "int" loop variablesinstead to silence the warnings. (This matches what we've donein other places, for example loops over the range of ForkNumber.)While at it, let's drop the XXX_FIRST macros for these enums and justwrite zeroes for the loop start values. The apparent flexibilityseems rather illusory given that iterating up to one-less-than-the-number-of-values is only correct for a zero-based range.Melanie PlagemanDiscussion:https://postgr.es/m/20520.1677435600@sss.pgh.pa.us1 parent53fe7e6 commit728560d
File tree
3 files changed
+10
-20
lines changed- src
- backend/utils
- activity
- adt
- include
3 files changed
+10
-20
lines changedLines changed: 6 additions & 11 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
36 | 36 |
| |
37 | 37 |
| |
38 | 38 |
| |
39 |
| - | |
40 |
| - | |
| 39 | + | |
41 | 40 |
| |
42 |
| - | |
43 |
| - | |
| 41 | + | |
44 | 42 |
| |
45 | 43 |
| |
46 | 44 |
| |
47 | 45 |
| |
48 | 46 |
| |
49 | 47 |
| |
50 |
| - | |
| 48 | + | |
51 | 49 |
| |
52 | 50 |
| |
53 | 51 |
| |
| |||
111 | 109 |
| |
112 | 110 |
| |
113 | 111 |
| |
114 |
| - | |
115 |
| - | |
| 112 | + | |
116 | 113 |
| |
117 |
| - | |
118 |
| - | |
| 114 | + | |
119 | 115 |
| |
120 |
| - | |
121 |
| - | |
| 116 | + | |
122 | 117 |
| |
123 | 118 |
| |
124 | 119 |
| |
|
Lines changed: 4 additions & 6 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
1306 | 1306 |
| |
1307 | 1307 |
| |
1308 | 1308 |
| |
1309 |
| - | |
| 1309 | + | |
1310 | 1310 |
| |
1311 | 1311 |
| |
1312 | 1312 |
| |
| |||
1325 | 1325 |
| |
1326 | 1326 |
| |
1327 | 1327 |
| |
1328 |
| - | |
1329 |
| - | |
| 1328 | + | |
1330 | 1329 |
| |
1331 | 1330 |
| |
1332 | 1331 |
| |
1333 |
| - | |
1334 |
| - | |
| 1332 | + | |
1335 | 1333 |
| |
1336 | 1334 |
| |
1337 | 1335 |
| |
| |||
1359 | 1357 |
| |
1360 | 1358 |
| |
1361 | 1359 |
| |
1362 |
| - | |
| 1360 | + | |
1363 | 1361 |
| |
1364 | 1362 |
| |
1365 | 1363 |
| |
|
Lines changed: 0 additions & 3 deletions
Original file line number | Diff line number | Diff line change | |
---|---|---|---|
| |||
287 | 287 |
| |
288 | 288 |
| |
289 | 289 |
| |
290 |
| - | |
291 | 290 |
| |
292 | 291 |
| |
293 | 292 |
| |
| |||
298 | 297 |
| |
299 | 298 |
| |
300 | 299 |
| |
301 |
| - | |
302 | 300 |
| |
303 | 301 |
| |
304 | 302 |
| |
| |||
311 | 309 |
| |
312 | 310 |
| |
313 | 311 |
| |
314 |
| - | |
315 | 312 |
| |
316 | 313 |
| |
317 | 314 |
| |
|
0 commit comments
Comments
(0)