pgsql: Tweak __attribute__-wrapping macros for better pgindent results. - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Tweak __attribute__-wrapping macros for better pgindent results.
Date
Msg-id E1YbC84-0001RF-6u@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
Tweak __attribute__-wrapping macros for better pgindent results.

This improves on commit bbfd7edae5aa5ad5553d3c7e102f2e450d4380d4 by
making two simple changes:

* pg_attribute_noreturn now takes parentheses, ie pg_attribute_noreturn().
Likewise pg_attribute_unused(), pg_attribute_packed().  This reduces
pgindent's tendency to misformat declarations involving them.

* attributes are now always attached to function declarations, not
definitions.  Previously some places were taking creative shortcuts,
which were not merely candidates for bad misformatting by pgindent
but often were outright wrong anyway.  (It does little good to put a
noreturn annotation where callers can't see it.)  In any case, if
we would like to believe that these macros can be used with non-gcc
compilers, we should avoid gratuitous variance in usage patterns.

I also went through and manually improved the formatting of a lot of
declarations, and got rid of excessively repetitive (and now obsolete
anyway) comments informing the reader what pg_attribute_printf is for.

Branch
------
master

Details
-------
http://git.postgresql.org/pg/commitdiff/785941cdc359c6e595201ffb0df9d28f3f7173a4

Modified Files
--------------
contrib/cube/cube.c                         |    5 --
contrib/cube/cubedata.h                     |    9 +++
contrib/cube/cubeparse.y                    |    5 --
contrib/cube/cubescan.l                     |   10 +--
contrib/pg_upgrade/pg_upgrade.h             |   33 +++-----
contrib/pg_upgrade/util.c                   |    7 +-
contrib/pg_xlogdump/pg_xlogdump.c           |    4 +-
contrib/pgcrypto/px.h                       |    4 +-
contrib/seg/seg.c                           |   10 ---
contrib/seg/segdata.h                       |   12 +++
contrib/seg/segparse.y                      |    8 +-
contrib/seg/segscan.l                       |   10 +--
src/backend/access/transam/xlogreader.c     |    6 +-
src/backend/postmaster/autovacuum.c         |    4 +-
src/backend/postmaster/pgarch.c             |    2 +-
src/backend/postmaster/pgstat.c             |    2 +-
src/backend/postmaster/postmaster.c         |    4 +-
src/backend/postmaster/syslogger.c          |    2 +-
src/backend/replication/repl_scanner.l      |    2 +-
src/backend/replication/walsender.c         |    2 +-
src/backend/utils/error/elog.c              |    6 +-
src/backend/utils/misc/guc.c                |    5 +-
src/bin/pg_ctl/pg_ctl.c                     |    6 +-
src/bin/pg_dump/parallel.c                  |    6 +-
src/bin/pg_dump/pg_backup.h                 |    5 +-
src/bin/pg_dump/pg_backup_utils.h           |   14 +---
src/bin/pg_rewind/logging.h                 |    6 +-
src/bin/psql/common.h                       |    5 +-
src/bin/psql/large_obj.c                    |    4 +-
src/include/bootstrap/bootstrap.h           |    4 +-
src/include/c.h                             |   24 +++---
src/include/common/fe_memutils.h            |    8 +-
src/include/lib/stringinfo.h                |    9 +--
src/include/mb/pg_wchar.h                   |    4 +-
src/include/parser/parse_relation.h         |    4 +-
src/include/parser/scanner.h                |    2 +-
src/include/pgstat.h                        |    2 +-
src/include/port.h                          |   20 +----
src/include/postgres.h                      |    2 +-
src/include/postmaster/autovacuum.h         |    4 +-
src/include/postmaster/bgworker_internals.h |    2 +-
src/include/postmaster/bgwriter.h           |    4 +-
src/include/postmaster/pgarch.h             |    2 +-
src/include/postmaster/postmaster.h         |    4 +-
src/include/postmaster/startup.h            |    2 +-
src/include/postmaster/syslogger.h          |    2 +-
src/include/postmaster/walwriter.h          |    2 +-
src/include/replication/walreceiver.h       |    2 +-
src/include/replication/walsender_private.h |    2 +-
src/include/storage/ipc.h                   |    2 +-
src/include/storage/itemptr.h               |    2 +-
src/include/storage/lock.h                  |    2 +-
src/include/tcop/tcopprot.h                 |    6 +-
src/include/utils/datetime.h                |    2 +-
src/include/utils/elog.h                    |  113 +++++++--------------------
src/include/utils/help_config.h             |    2 +-
src/include/utils/palloc.h                  |    8 +-
src/interfaces/ecpg/include/ecpglib.h       |    4 +-
src/interfaces/ecpg/preproc/ecpg.header     |    4 +-
src/interfaces/ecpg/preproc/extern.h        |    2 +-
src/interfaces/libpq/libpq-int.h            |   13 +--
src/interfaces/libpq/pqexpbuffer.c          |    4 +-
src/interfaces/libpq/pqexpbuffer.h          |   10 +--
src/interfaces/libpq/win32.c                |    4 +-
src/pl/plperl/plperl.h                      |    2 +-
src/pl/plpgsql/src/pl_scanner.c             |    2 +-
src/pl/plpgsql/src/plpgsql.h                |    2 +-
src/pl/plpython/plpy_elog.h                 |   15 +---
src/test/modules/test_shm_mq/test_shm_mq.h  |    2 +-
src/test/modules/worker_spi/worker_spi.c    |    2 +-
src/test/regress/pg_regress.c               |   18 +----
71 files changed, 168 insertions(+), 356 deletions(-)


pgsql-committers by date:

Previous
From: Heikki Linnakangas
Date:
Subject: pgsql: Add support for index-only scans in GiST.
Next
From: Heikki Linnakangas
Date:
Subject: pgsql: Fix GiST index-only scans for opclasses with different storage t