Re: do {} while (0) nitpick

Поиск
Список
Период
Сортировка
От Jesse Zhang
Тема Re: do {} while (0) nitpick
Дата
Msg-id CAGf+fX6pvwFiK16BuHj81-p2OEPD3Zg2zbn2JobX20YmjwV6cg@mail.gmail.com
обсуждение исходный текст
Ответ на Re: do {} while (0) nitpick  (Tom Lane <tgl@sss.pgh.pa.us>)
Ответы Re: do {} while (0) nitpick  (Tom Lane <tgl@sss.pgh.pa.us>)
Список 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



В списке pgsql-hackers по дате отправления:

Предыдущее
От: Julien Rouhaud
Дата:
Сообщение: Re: WAL usage calculation patch
Следующее
От: Tom Lane
Дата:
Сообщение: Re: do {} while (0) nitpick