[PATCH] C++ and sys/resource.h
Jakub Jelinek
jakub@redhat.com
Thu Jul 18 01:53:00 GMT 2002
Hi!
See http://bugzilla.redhat.com/bugzilla/show_bug.cgi?id=68588.
Although it is mainly libstdc++'s fault that -D_GNU_SOURCE is used
unconditionally, I think:
#include <sys/resource.h>
namespace Wrapper {
void setrlimit(int limit, const struct rlimit *rlp) {
::setrlimit(limit, rlp);
}
}
should compile in C++ even with -D_GNU_SOURCE explicitely given.
Unlike in C where the implicit conversion would be
done without any complaint, in C++ this is a problem.
2002-07-18 Jakub Jelinek <jakub@redhat.com>
* resource/sys/resource.h (__rlimit_resource_t, __rusage_who_t,
__priority_which_t): Always typedef to int for C++.
--- libc/resource/sys/resource.h.jj Thu Aug 23 18:49:01 2001
+++ libc/resource/sys/resource.h Thu Jul 18 11:08:42 2002
@@ -35,7 +35,7 @@ __BEGIN_DECLS
`int' as the type for the first argument. When we are compiling with
GNU extensions we change this slightly to provide better error
checking. */
-#ifdef __USE_GNU
+#if defined __USE_GNU && !defined __cplusplus
typedef enum __rlimit_resource __rlimit_resource_t;
typedef enum __rusage_who __rusage_who_t;
typedef enum __priority_which __priority_which_t;
Jakub
More information about the Libc-hacker
mailing list