'errno' undefined?

Started by Philip Warnerover 25 years ago7 messages
#1Philip Warner
pjw@rhyme.com.au

I get the following when building cvs:

gcc -I../../include -O2 -g -Wall -Wmissing-prototypes
-Wmissing-declarations -c pqformat.c -o pqformat.o
pqformat.c: In function `pq_endmessage':
pqformat.c:219: `errno' undeclared (first use in this function)
pqformat.c:219: (Each undeclared identifier is reported only once
pqformat.c:219: for each function it appears in.)
make: *** [pqformat.o] Error 1

Any ideas?

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

#2Tom Lane
tgl@sss.pgh.pa.us
In reply to: Philip Warner (#1)
Re: 'errno' undefined?

Philip Warner <pjw@rhyme.com.au> writes:

I get the following when building cvs:

Is that with the be-pqexec removal I just did? I pulled out a couple
of header inclusions that I thought were no longer necessary --- and
they weren't on my platform. But maybe something in there was needed
on yours. Where does errno get declared in your system's headers?

regards, tom lane

#3Philip Warner
pjw@rhyme.com.au
In reply to: Tom Lane (#2)
Re: 'errno' undefined?

At 00:57 8/07/00 -0400, Tom Lane wrote:

Philip Warner <pjw@rhyme.com.au> writes:

I get the following when building cvs:

Is that with the be-pqexec removal I just did? I pulled out a couple
of header inclusions that I thought were no longer necessary --- and
they weren't on my platform. But maybe something in there was needed
on yours. Where does errno get declared in your system's headers?

errno.h

----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

#4Tom Lane
tgl@sss.pgh.pa.us
In reply to: Philip Warner (#3)
Re: 'errno' undefined?

Philip Warner <pjw@rhyme.com.au> writes:

they weren't on my platform. But maybe something in there was needed
on yours. Where does errno get declared in your system's headers?

errno.h

Hmm. The stuff I just removed doesn't look like it would cause an
inclusion of errno.h. Which other system headers include errno.h
on your box?

The answer probably is that pqformat.h needs to include <errno.h>,
but I'm just curious to understand why it didn't before ...

regards, tom lane

#5Philip Warner
pjw@rhyme.com.au
In reply to: Tom Lane (#4)
Re: 'errno' undefined?

At 01:17 8/07/00 -0400, Tom Lane wrote:

Hmm. The stuff I just removed doesn't look like it would cause an
inclusion of errno.h. Which other system headers include errno.h
on your box?

The answer probably is that pqformat.h needs to include <errno.h>,
but I'm just curious to understand why it didn't before ...

pjw@Cerberus2:~/work/postgresql-cvs/pgsql > grep errno.h /usr/include/*.h
/usr/include/argz.h:#include <errno.h>
/usr/include/envz.h:#include <errno.h>
/usr/include/errno.h: * ISO C Standard: 4.1.3 Errors <errno.h>
/usr/include/errno.h:#endif /* errno.h */
/usr/include/errnos.h:# include <linux/errno.h>
/usr/include/pthread.h:#include <errno.h>

pjw@Cerberus2:~/work/postgresql-cvs/pgsql > grep errno.h /usr/include/*/*.h
/usr/include/X11/Xlibint.h:#include <errno.h>
/usr/include/X11/Xos.h:#include <errno.h>
/usr/include/asm/unistd.h:/* user-visible error numbers are in the range -1
- -122: see <asm-i386/errno.h> */
/usr/include/linux/errno.h:#include <asm/errno.h>
/usr/include/linux/isdn.h:#include <linux/errno.h>
/usr/include/linux/mm.h:#include <linux/errno.h>
/usr/include/linux/notifier.h:#include <linux/errno.h>
/usr/include/linux/quota.h:#include <linux/errno.h>
/usr/include/mysql/my_sys.h:#include <errno.h> /* errno is
a define */
/usr/include/python1.5/Python.h:#include <errno.h>
/usr/include/rpcsvc/bootparam.h:#include <sys/errno.h>
/usr/include/rpcsvc/bootparam_prot.h:#include <sys/errno.h>
/usr/include/sys/errno.h:#include <errno.h>

no matches in local/include
----------------------------------------------------------------
Philip Warner | __---_____
Albatross Consulting Pty. Ltd. |----/ - \
(A.C.N. 008 659 498) | /(@) ______---_
Tel: (+61) 0500 83 82 81 | _________ \
Fax: (+61) 0500 83 82 82 | ___________ |
Http://www.rhyme.com.au | / \|
| --________--
PGP key available upon request, | /
and from pgp5.ai.mit.edu:11371 |/

#6Tom Lane
tgl@sss.pgh.pa.us
In reply to: Philip Warner (#5)
Re: 'errno' undefined?

The answer probably is that pqformat.h needs to include <errno.h>,
but I'm just curious to understand why it didn't before ...

Well, I noticed that <stdlib.h> pulls in <errno.h> on my box, so that
explains why I didn't see a problem. I still don't see the connection
between the includes I killed and <errno.h> on your box, though...
curious. Anyway I committed the change to pqformat.c.

regards, tom lane

#7Giles Lean
giles@nemeton.com.au
In reply to: Tom Lane (#2)
Re: 'errno' undefined?

Where does errno get declared in your system's headers?

The ANSI C standard says errno is declared in <errno.h>. Since ANSI C
also says that the standard header files are independent, it is poor
form for your system to have included <errno.h> via <stdlib.h>.

(Yeah, since you've already added <errno.h> this is a bit pedantic.)

Ciao,

Giles