Re: Upgrading the backend's error-message infrastructure

From: Larry Rosenman <ler(at)lerctr(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, pgsql-hackers(at)postgresql(dot)org, pgsql-interfaces(at)postgresql(dot)org
Subject: Re: Upgrading the backend's error-message infrastructure
Date: 2003-03-13 21:13:40
Message-ID: 73290000.1047590020@lerlaptop.lerctr.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-interfaces

--On Thursday, March 13, 2003 15:51:00 -0500 Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
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 <stdio.h>
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(at)lerctr(dot)org
US Mail: 1905 Steamboat Springs Drive, Garland, TX 75044-6749

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2003-03-13 21:20:21 Re: Upgrading the backend's error-message infrastructure
Previous Message Taral 2003-03-13 21:10:49 No merge sort?

Browse pgsql-interfaces by date

  From Date Subject
Next Message Tom Lane 2003-03-13 21:20:21 Re: Upgrading the backend's error-message infrastructure
Previous Message Tom Lane 2003-03-13 20:51:00 Upgrading the backend's error-message infrastructure