Re: [PATCH] warning: suggest braces around empty body in an 'else' statement
В списке pgsql-hackers по дате отправления:
| От | Tom Lane |
|---|---|
| Тема | Re: [PATCH] warning: suggest braces around empty body in an 'else' statement |
| Дата | |
| Msg-id | 7768.1383869372@sss.pgh.pa.us обсуждение |
| Ответ на | [PATCH] warning: suggest braces around empty body in an 'else' statement (Andres Freund <andres@2ndquadrant.com>) |
| Список | pgsql-hackers |
Andres Freund <andres@2ndquadrant.com> writes:
> Compiling postgres I currently get the following warning when compiling
> without LOCK_DEBUG:
> /home/andres/src/postgresql/src/backend/storage/lmgr/lock.c:944:52:
> warning: suggest braces around empty body in an 'else' statement [-Wempty-body]
> PROCLOCK_PRINT("LockAcquire: NOWAIT", proclock);
> It'd be easy to just disable the warning with -Wno-empty-body, but I actually like
> the warning.
> It's easy to fix by defining PROCLOCK_PRINT to (void)0 instead of
> defining it empty when LOCK_DEBUG is enabled.
Seems reasonable, and probably a good policy even without compiler
warnings pushing us to do it --- things that look like functions
should expand to expressions, IMO, not empty.
Committed with some extra parentheses just for luck.
regards, tom lane
В списке pgsql-hackers по дате отправления:
Сайт использует файлы cookie для корректной работы и повышения удобства. Нажимая кнопку «Принять» или продолжая пользоваться сайтом, вы соглашаетесь на их использование в соответствии с Политикой в отношении обработки cookie ООО «ППГ», в том числе на передачу данных из файлов cookie сторонним статистическим и рекламным службам. Вы можете управлять настройками cookie через параметры вашего браузера