pgindent and prototypes - Mailing list pgsql-hackers

From Bruce Momjian
Subject pgindent and prototypes
Date
Msg-id 199808090449.AAA01661@candle.pha.pa.us
Whole thread Raw
List pgsql-hackers
BSD indent, and hence pgindent, has a problem identifying the difference
between function prototypes and functions when the prototype spans more
than line line, i.e.:

    static
    func(int x,
         int y)

and

    static
    func(int x,
         int y);

format the same, while the second should format as:

    static func(int x,
                int y);

I have talked to BSDI about the bug [BSDI-Support-Request #51998], and
though they have cheerfully fixed many of the other indent bugs, this
one it going to be much more difficult.  I have looked at the code
myself, and it looks very complicated to fix.

I have decided to work around the bug by adding some awk code to
pgindent to fix the problem by finding potential function prototypes,
and changing the formatting into prototypes where appropriate.

Why is this important?  Ctags, which is almost necessary with the 250k
lines of code in PostgreSQL, looks for the function name starting in
column 1. If a static function has a prototype, when you ctags into the
file, it ctags finds the prototype, and not the actual function.

I will run the new pgindent as part of the normal pre-beta release
process at the end of this month.

--
Bruce Momjian                          |  830 Blythe Avenue
maillist@candle.pha.pa.us              |  Drexel Hill, Pennsylvania 19026
  +  If your life is a hard drive,     |  (610) 353-9879(w)
  +  Christ can be your backup.        |  (610) 853-3000(h)

pgsql-hackers by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [HACKERS] thread-safe libpq and DBD::Pg
Next
From: Peter T Mount
Date:
Subject: Re: [HACKERS] current CVS tree