Обсуждение: pgsql: Fix declaration after statement

Поиск
Список
Период
Сортировка

pgsql: Fix declaration after statement

От
Alvaro Herrera
Дата:
Fix declaration after statement

This style is frowned upon.  I inadvertently introduced one in commit
fe0e0b4fc7f0.  (My compiler does not complain about it, even though
-Wdeclaration-after-statement is specified.  Weird.)

Author: Masahiko Sawada

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/65d857d92c418d732e3531a3761a32f2e352cb35

Modified Files
--------------
src/bin/pgbench/pgbench.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)


Re: pgsql: Fix declaration after statement

От
Tom Lane
Дата:
Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> (My compiler does not complain about it, even though
> -Wdeclaration-after-statement is specified.  Weird.)

longfin's compiler doesn't either (clang-1001.0.46.3).
What are you using?  Maybe we should be filing bug reports?

            regards, tom lane



Re: pgsql: Fix declaration after statement

От
Thomas Munro
Дата:
On Thu, Apr 11, 2019 at 5:05 PM Tom Lane <tgl@sss.pgh.pa.us> wrote:
> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > (My compiler does not complain about it, even though
> > -Wdeclaration-after-statement is specified.  Weird.)
>
> longfin's compiler doesn't either (clang-1001.0.46.3).
> What are you using?  Maybe we should be filing bug reports?

If you're filing a complaint, note that that's not a real clang
version number, that's Apple's unhelpful parallel version system.
clang 9 isn't out yet.  According to [1], Apple clang "10.0.1" is
really upstream clang 7 (and Apple clang "10.0.0" is upstream clang 6,
despite deferring only in the "patch" component of the version).  The
crazy thing is that it *almost* lines up with the Xcode version
numbers, but not quite.

I just tested clang 8 (FreeBSD 13 system compiler) and clang 9 (ports
llvm-devel, which tracks bleeding edge llvm head) and they both seem
to ignore -Wdeclaration-after-statement.  GCC 8 warns for my test
program.

[1] https://en.wikipedia.org/wiki/Xcode#Latest_versions

-- 
Thomas Munro
https://enterprisedb.com



Re: pgsql: Fix declaration after statement

От
Alvaro Herrera
Дата:
On 2019-Apr-11, Tom Lane wrote:

> Alvaro Herrera <alvherre@alvh.no-ip.org> writes:
> > (My compiler does not complain about it, even though
> > -Wdeclaration-after-statement is specified.  Weird.)
> 
> longfin's compiler doesn't either (clang-1001.0.46.3).
> What are you using?  Maybe we should be filing bug reports?

gcc (Ubuntu 7.3.0-27ubuntu1~18.04) 7.3.0
under
ccache version 3.4.1


-- 
Álvaro Herrera                https://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services