shadow variables - pg15 edition
Justin Pryzby <pryzby@telsasoft.com>
From: Justin Pryzby <pryzby@telsasoft.com>
To: pgsql-hackers@postgresql.org
Cc: Tomas Vondra <tomas.vondra@postgresql.org>, Peter Smith <smithpb2250@gmail.com>, David Rowley <dgrowleyml@gmail.com>
Date: 2022-08-17T14:54:35Z
Lists: pgsql-hackers
Attachments
- 0001-avoid-shadow-vars-pg_dump.c-i_oid.patch (text/x-diff)
There's been no progress on this in the past discussions. https://www.postgresql.org/message-id/flat/877k1psmpf.fsf%40mailbox.samurai.com https://www.postgresql.org/message-id/flat/CAApHDvpqBR7u9yzW4yggjG%3DQfN%3DFZsc8Wo2ckokpQtif-%2BiQ2A%40mail.gmail.com#2d900bfe18fce17f97ec1f00800c8e27 https://www.postgresql.org/message-id/flat/MN2PR18MB2927F7B5F690065E1194B258E35D0%40MN2PR18MB2927.namprd18.prod.outlook.com But an unfortunate consequence of not fixing the historic issues is that it precludes the possibility that anyone could be expected to notice if they introduce more instances of the same problem (as in the first half of these patches). Then the hole which has already been dug becomes deeper, further increasing the burden of fixing the historic issues before being able to use -Wshadow. The first half of the patches fix shadow variables newly-introduced in v15 (including one of my own patches), the rest are fixing the lowest hanging fruit of the "short list" from COPT=-Wshadow=compatible-local I can't see that any of these are bugs, but it seems like a good goal to move towards allowing use of the -Wshadow* options to help avoid future errors, as well as cleanliness and readability (rather than allowing it to get harder to use -Wshadow). -- Justin
Commits
-
Fix shadow variable in postgres.c
- 4574eb9d38c6 16.0 landed
-
Add -Wshadow=compatible-local to the standard compilation flags
- 0fe954c28584 16.0 landed
-
Fix final warnings produced by -Wshadow=compatible-local
- cd4e8caaa0eb 16.0 landed
-
Fix final compiler warning produced by -Wshadow=compatible-local
- d8df67bb1ad9 16.0 landed
-
Add optional parameter to PG_TRY() macros
- 112f0225dbfe 16.0 landed
-
Small refactor to get rid of -Wshadow=compatible-local warning
- d389487525bc 16.0 landed
-
More -Wshadow=compatible-local warning fixes
- 3e0fff2e6888 16.0 landed
-
Further -Wshadow=compatible-local warning fixes
- f959bf9a5b9c 16.0 landed
-
Further reduce warnings with -Wshadow=compatible-local
- 421892a192b8 16.0 landed
-
Reduce warnings with -Wshadow=compatible-local builds
- 92fce4e1eda9 16.0 landed
-
Remove shadowed local variables that are new in v15
- 24f457aa2b70 15.0 landed
- f01592f91577 16.0 landed