Author: sebor
Date: Mon Jan 9 11:48:30 2006
New Revision: 367374
URL: http://svn.apache.org/viewcvs?rev=367374&view=rev
Log:
2006-01-09 Martin Sebor <[EMAIL PROTECTED]>
STDCXX-107
* MUNMAP.cpp (<sys/types.h>): Included to prevent compilation errors
in <sys/mman.h> on BSD.
Modified:
incubator/stdcxx/trunk/etc/config/src/MUNMAP.cpp
Modified: incubator/stdcxx/trunk/etc/config/src/MUNMAP.cpp
URL:
http://svn.apache.org/viewcvs/incubator/stdcxx/trunk/etc/config/src/MUNMAP.cpp?rev=367374&r1=367373&r2=367374&view=diff
==============================================================================
--- incubator/stdcxx/trunk/etc/config/src/MUNMAP.cpp (original)
+++ incubator/stdcxx/trunk/etc/config/src/MUNMAP.cpp Mon Jan 9 11:48:30 2006
@@ -4,7 +4,10 @@
# include "config.h"
#endif // _RWSTD_USE_CONFIG
-#include <sys/mman.h>
+// include <sys/types.h> first in case mman.h depends
+// on it (such as the one on Darwin -- see STDCXX-107)
+#include <sys/types.h> // for size_t
+#include <sys/mman.h> // for munmap()
extern "C" {
@@ -14,13 +17,14 @@
}
-const char* foo (f_i_vpui*) { return "void*"; }
-const char* foo (f_i_cpui*) { return "char*"; }
+const char* munmap_arg2_type_imp (f_i_vpui*) { return "void*"; }
+const char* munmap_arg2_type_imp (f_i_cpui*) { return "char*"; }
-
-const char* bar ()
+// determine whether the type of the second argument
+// to munmap() is void* or char*
+const char* get_munmap_arg2_type ()
{
- return foo (&munmap);
+ return munmap_arg2_type_imp (&munmap);
}
@@ -31,14 +35,14 @@
int main ()
{
- const char *argtype = bar ();
-
#if !defined (_RWSTD_USE_CONFIG)
printf ("/**/\n#undef _RWSTD_MUNMAP\n");
#endif // _RWSTD_USE_CONFIG
+ const char *argtype = get_munmap_arg2_type ();
+
printf ("#define _RWSTD_MUNMAP_ARG1_T %s\n", argtype);
return 0;