From: | Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> |
---|---|
To: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Cc: | PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: Declared but no defined functions |
Date: | 2019-07-06 23:31:12 |
Message-ID: | CAD21AoDx3++hYqsGTZgm3voiBhMmhKg0cX6K5Rztti-PYVdr2g@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Sat, Jul 6, 2019 at 7:32 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>
> Masahiko Sawada <sawada(dot)mshk(at)gmail(dot)com> writes:
> > I think the following functions are mistakenly left in the header
> > file. So attached patch removes them.
>
> > dsa_startup()
> > TransactionIdAbort()
> > renameatt_type()
>
> Agreed, these are referenced nowhere. I pushed the patch.
Thanks.
>
> > I realized that TransactionIdAbort is declared in the transam.h but
> > there is not its function body. As far as I found there are three
> > similar functions in total by the following script.
> > for func in `git ls-files | egrep "\w+\.h$" | xargs cat | egrep
> > "extern \w+ \w+\(.*\);" | sed -e "s/.* \(.*\)(.*);/\1(/g"`
> > do
> > if [ `git grep "$func" -- "*.c" | wc -l` -lt 1 ];then
> > echo $func
> > fi
> > done
>
> FWIW, that won't catch declarations that lack "extern", nor functions
> that return pointer-to-something. (Omitting "extern" is something
> I consider bad style, but other people seem to be down with it.)
> Might be worth another pass to look harder?
>
Indeed. I've tried to search again with the following script and got
more such functions.
for func in `git ls-files | egrep "\w+\.h$" | xargs cat | egrep -v
"(^typedef)|(DECLARE)|(BKI)" | egrep "^(extern )*[\_0-9A-Za-z]+
[\_\*0-9a-zA-Z]+ ?\(.+\);$" | sed -e "s/\(^extern \)*[\_0-9A-Za-z]\+
\([\_0-9A-Za-z\*]\+\) \{0,1\}(.*);$/\2(/g" | sed -e "s/\*//g"`
do
if [ "`git grep "$func" -- "*.c" | wc -l`" -lt 1 ];then
echo $func
fi
done
Attached patch removes these functions.
Regards,
--
Masahiko Sawada
NIPPON TELEGRAPH AND TELEPHONE CORPORATION
NTT Open Source Software Center
Attachment | Content-Type | Size |
---|---|---|
remove_non_defined_funcs_2.patch | text/x-patch | 2.0 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Michael Paquier | 2019-07-07 01:04:40 | Re: Declared but no defined functions |
Previous Message | Peter Geoghegan | 2019-07-06 23:08:21 | Re: [HACKERS] [WIP] Effective storage of duplicates in B-tree index. |