Re: do {} while (0) nitpick
Jesse Zhang <sbjesse@gmail.com>
From: Jesse Zhang <sbjesse@gmail.com>
To: Tom Lane <tgl@sss.pgh.pa.us>
Cc: John Naylor <john.naylor@2ndquadrant.com>, PostgreSQL-development <pgsql-hackers@postgresql.org>
Date: 2020-05-04T15:01:56Z
Lists: pgsql-hackers
Hi Tom, On Fri, May 1, 2020 at 2:32 PM Tom Lane wrote: > > Grepping showed me that there were some not-do-while macros that > also had trailing semicolons. These seem just as broken, so I > fixed 'em all. > I'm curious: *How* are you able to discover those occurrences with grep? I understand how John might have done it with his original patch: it's quite clear the pattern he would look for looks like "while (0);" but how did you find all these other macro definitions with a trailing semicolon? My tiny brain can only imagine: 1. Either grep for trailing semicolon (OMG almost every line will come up) and squint through the context the see the previous line has a trailing backslash; 2. Or use some LLVM magic to spelunk through every macro definition and look for a trailing semicolon Cheers, Jesse
Commits
-
Get rid of trailing semicolons in C macro definitions.
- ad80d3ea27b1 9.5.22 landed
- a8df87d8638c 9.6.18 landed
- a2098b60216c 11.8 landed
- 49718aa9ee5e 10.13 landed
- c08da32f133b 12.3 landed
- 0da06d9faf9e 13.0 landed