bug-groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Current CVS: incorrect re-decrlaration of errno


From: Andrej Borsenkow
Subject: Current CVS: incorrect re-decrlaration of errno
Date: Fri, 22 Sep 2000 10:42:05 +0400

CC -I. -I/u3/u1/src/groff/src/preproc/html2 -I/tools/build/groff/src/include -
I/tools/src/groff/src/include -DHAVE_STDLIB_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DIREN
T_H=1 -DHAVE_LIMITS_H=1 -DHAVE_SYS_DIR_H=1 -DHAVE_STRING_H=1 -DHAVE_STRINGS_H=
1 -DHAVE_MATH_H=1 -DRET_TYPE_SRAND_IS_VOID=1 -DNEED_DECLARATION_STRNCASECMP=1 
-DHAVE_CC_LIMITS_H=1 -DRETSIGTYPE=void -DHAVE_STRUCT_EXCEPTION=1 -DHAVE_UNISTD
_H=1 -DHAVE_MMAP=1 -DHAVE_FMOD=1 -DHAVE_STRTOL=1 -DHAVE_GETCWD=1 -DHAVE_STRERR
OR=1 -DHAVE_PUTENV=1 -DHAVE_RENAME=1 -DHAVE_STRCASECMP=1 -DHAVE_STRNCASECMP=1 
-DHAVE_STRDUP=1  -O  -c /u3/u1/src/groff/src/preproc/html2/pre-html.cc
/u3/u1/src/groff/src/preproc/html2/pre-html.cc   100: [error]:   CFE1266
"errno" is ambiguous
...

the reason is the following:

#include <errno.h>
...
#ifndef errno
extern int errno;
#endif

This is plain wrong; you cannot assume that errno is #define'd. It is
*declared* in <errno.h> and the second redeclaration fails for C++ (well, it
may be subtle namespace problem - our compiler does some tricks with
namespaces in standard includes).

The correct way is to check for *declaration* of errno and define it if not
declared. The check for definition may be used as fallback if no declaration
is found.

Note, that problem is *not* limited to pre-html.cc - it is just the first file
where compiler breaks.

regards

-andrej

Have a nice DOS!
B >>



reply via email to

[Prev in Thread] Current Thread [Next in Thread]