This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Broken include/c_std/bits/std_cerrno.h
- To: libstdc++ at gcc dot gnu dot org
- Subject: Re: Broken include/c_std/bits/std_cerrno.h
- From: Benjamin Kosnik <bkoz at redhat dot com>
- Date: Tue, 6 Mar 2001 12:08:42 -0800 (PST)
For "C++" iso/14882
17.4.1.2 Headers
p 5
names which are defined as macros in C shall be defined as macros in the
C++ stdlib, even if C grants license for implementation as functions.
(note names defined as macros in C include the following: assert, errno,
offsetof, setjmp, va_arg, va_end, va_start)
so
cassert
cerrno
cstddef
csetjmp
cstdarg
all needed to be reviewed for conformance with this. I'll do this right
now and post a patch.
> In include/c_std/bits/, the file std_cerrno.h is just wrong.
> In particular, ISO 14882 _requires_ that in C++ errno be a macro,
> not a namespaced object. As it happens, the contents of that file
> do fail if errno does happen to be a macro.
can you please provide a testcase?
Here's one:
#include <cerrno>
namespace gnu
{
void test01()
{
int i = errno;
#ifndef errno
#error "errno_must_be_a_macro"
#endif
}
}
int main()
{
gnu::test01();
return 0;
}
> I have attached a patch, but I'm not sure the file shouldn't just
> be deleted outright. The c_std stuff, if I understand correctly,
> isn't intended to be right anyway, it just shouldn't make old
> programs stop compiling. I think deleting the file would accomplish
> that.
Hmm. Can't do that, as include/std/cerrno includes it, and that file has
to work with all the various "C" compatibility strategies: c, c_std,
c_shadow. So, we should probably keep the file and do the diffs as you
suggested.
-benjamin