X-Original-To: pgsql-hackers@postgresql.org Received: from lerami.lerctr.org (lerami.lerctr.org [207.158.72.11]) by postgresql.org (Postfix) with ESMTP id 076EA4758F1; Thu, 13 Mar 2003 16:13:58 -0500 (EST) Received: from pppth08-305.ght.iadfw.net (pppth08-305.ght.iadfw.net [207.136.52.179]) (authenticated bits=0) by lerami.lerctr.org (8.12.8/8.12.8/20030225) with ESMTP id h2DLDifS005245; Thu, 13 Mar 2003 15:13:46 -0600 (CST) Date: Thu, 13 Mar 2003 15:13:40 -0600 From: Larry Rosenman To: Tom Lane , pgsql-hackers@postgresql.org, pgsql-interfaces@postgresql.org Subject: Re: Upgrading the backend's error-message infrastructure Message-ID: <73290000.1047590020@lerlaptop.lerctr.org> In-Reply-To: <9168.1047588660@sss.pgh.pa.us> References: <9168.1047588660@sss.pgh.pa.us> X-Mailer: Mulberry/3.0.2 (Linux/x86) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Content-Disposition: inline X-Virus-Scanned: by amavisd-milter (http://amavis.org/) X-Archive-Number: 200303/569 X-Sequence-Number: 36815 --On Thursday, March 13, 2003 15:51:00 -0500 Tom Lane wrote: > (__FUNCTION__ is only used if we are compiling in gcc). errstart() pushes > an empty entry onto an error-data-collection stack and fills in the > behind-the-scenes file/line entries. errmsg() and friends stash values > into the top-level stack entry. Finally errfinish() assembles and emits > the completed message, then pops the stack. By using a stack, we can be > assured that things will work correctly if a message is logged by some > subroutine called in the parameters to ereport (not too unlikely when you > think about formatting functions like format_type_be()). > __FUNCTION__ or an equivalent is MANDATED by C99, and available on UnixWare's native cc. You might want to make a configure test for it. I believe the __func__ is the C99 spelling (that's what's available on UnixWare): $ cc -O -o testfunc testfunc.c $ ./testfunc function=main,file=testfunc.c,line=4 $ cat testfunc.c #include int main(int argc,char **argv) { printf("function=%s,file=%s,line=%d\n",__func__,__FILE__,__LINE__); } $ -- Larry Rosenman http://www.lerctr.org/~ler Phone: +1 972-414-9812 E-Mail: ler@lerctr.org US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749