This is the mail archive of the libc-hacker@sources.redhat.com mailing list for the glibc project.

Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] C++ and sys/resource.h


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]