From e81d3b1b46e69f9799deb665769f9796c4e454e6 Mon Sep 17 00:00:00 2001 From: Bruno Haible Date: Fri, 16 Sep 2011 23:43:21 +0200 Subject: [PATCH] Support for MSVC compiler: Ensure mode_t gets defined. * m4/fcntl_h.m4 (gl_FCNTL_H): Require AC_TYPE_MODE_T. * m4/spawn_h.m4 (gl_SPAWN_H): Likewise. * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise. * m4/sys_types_h.m4 (gl_SYS_TYPES_H): Likewise. * tests/test-fcntl-h.c: Check that mode_t is defined. * tests/test-sys_stat.c: Likewise. * tests/test-sys_types.c: Likewise. * doc/posix-headers/fcntl.texi: Mention the missing mode_t problem. * doc/posix-headers/sys_stat.texi: Likewise. * doc/posix-headers/sys_types.texi: Likewise. --- ChangeLog | 14 ++++++++++++++ doc/posix-headers/fcntl.texi | 4 ++++ doc/posix-headers/sys_stat.texi | 3 +++ doc/posix-headers/sys_types.texi | 3 +++ m4/fcntl_h.m4 | 5 ++++- m4/spawn_h.m4 | 5 ++++- m4/sys_stat_h.m4 | 5 ++++- m4/sys_types_h.m4 | 5 ++++- tests/test-fcntl-h.c | 1 + tests/test-sys_stat.c | 3 ++- tests/test-sys_types.c | 1 + 11 files changed, 44 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7f56e2235..9a6d45895 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2011-09-15 Bruno Haible + + Support for MSVC compiler: Ensure mode_t gets defined. + * m4/fcntl_h.m4 (gl_FCNTL_H): Require AC_TYPE_MODE_T. + * m4/spawn_h.m4 (gl_SPAWN_H): Likewise. + * m4/sys_stat_h.m4 (gl_HEADER_SYS_STAT_H): Likewise. + * m4/sys_types_h.m4 (gl_SYS_TYPES_H): Likewise. + * tests/test-fcntl-h.c: Check that mode_t is defined. + * tests/test-sys_stat.c: Likewise. + * tests/test-sys_types.c: Likewise. + * doc/posix-headers/fcntl.texi: Mention the missing mode_t problem. + * doc/posix-headers/sys_stat.texi: Likewise. + * doc/posix-headers/sys_types.texi: Likewise. + 2011-09-16 Bruno Haible sys_stat: Support for MSVC. diff --git a/doc/posix-headers/fcntl.texi b/doc/posix-headers/fcntl.texi index 598bf6943..332fe5ae2 100644 --- a/doc/posix-headers/fcntl.texi +++ b/doc/posix-headers/fcntl.texi @@ -12,6 +12,10 @@ The type @code{pid_t} is not defined on some platforms: MSVC 9. @item +The type @code{mode_t} is not defined on some platforms: +MSVC 9. + +@item @samp{O_CLOEXEC}, @samp{O_DIRECTORY}, @samp{O_DSYNC}, @samp{O_NOCTTY}, @samp{O_NOFOLLOW}, @samp{O_RSYNC}, @samp{O_SYNC}, and @samp{O_TTY_INIT} are not defined on some platforms. Gnulib defines diff --git a/doc/posix-headers/sys_stat.texi b/doc/posix-headers/sys_stat.texi index 86fd2deef..47b29f793 100644 --- a/doc/posix-headers/sys_stat.texi +++ b/doc/posix-headers/sys_stat.texi @@ -8,6 +8,9 @@ Gnulib module: sys_stat Portability problems fixed by Gnulib: @itemize @item +The type @code{mode_t} is not defined on some platforms: +MSVC 9. +@item Some macros, such as @code{S_IFMT} or @code{S_IFIFO}, are missing on some platforms. @item diff --git a/doc/posix-headers/sys_types.texi b/doc/posix-headers/sys_types.texi index f124171d8..35d24c0c7 100644 --- a/doc/posix-headers/sys_types.texi +++ b/doc/posix-headers/sys_types.texi @@ -16,6 +16,9 @@ MSVC 9. @item The type @code{ssize_t} is not defined on some platforms: MSVC 9. +@item +The type @code{mode_t} is not defined on some platforms: +MSVC 9. @end itemize Portability problems not fixed by Gnulib: diff --git a/m4/fcntl_h.m4 b/m4/fcntl_h.m4 index 346315c0b..03a41e670 100644 --- a/m4/fcntl_h.m4 +++ b/m4/fcntl_h.m4 @@ -1,4 +1,4 @@ -# serial 14 +# serial 15 # Configure fcntl.h. dnl Copyright (C) 2006-2007, 2009-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation @@ -16,6 +16,9 @@ AC_DEFUN([gl_FCNTL_H], dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + dnl Check for declarations of anything we want to poison if the dnl corresponding gnulib module is not in use, if it is not common dnl enough to be declared everywhere. diff --git a/m4/spawn_h.m4 b/m4/spawn_h.m4 index 33d30e6e9..5f0df9a62 100644 --- a/m4/spawn_h.m4 +++ b/m4/spawn_h.m4 @@ -1,4 +1,4 @@ -# spawn_h.m4 serial 14 +# spawn_h.m4 serial 15 dnl Copyright (C) 2008-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -34,6 +34,9 @@ AC_DEFUN([gl_SPAWN_H], dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + AC_REQUIRE([gl_HAVE_POSIX_SPAWN]) AC_REQUIRE([AC_C_RESTRICT]) diff --git a/m4/sys_stat_h.m4 b/m4/sys_stat_h.m4 index fc419129e..a3e46ca96 100644 --- a/m4/sys_stat_h.m4 +++ b/m4/sys_stat_h.m4 @@ -1,4 +1,4 @@ -# sys_stat_h.m4 serial 24 -*- Autoconf -*- +# sys_stat_h.m4 serial 25 -*- Autoconf -*- dnl Copyright (C) 2006-2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -19,6 +19,9 @@ AC_DEFUN([gl_HEADER_SYS_STAT_H], gl_CHECK_NEXT_HEADERS([sys/stat.h]) + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) + dnl Define types that are supposed to be defined in or dnl . AC_CHECK_TYPE([nlink_t], [], diff --git a/m4/sys_types_h.m4 b/m4/sys_types_h.m4 index 89dda82a2..62113df49 100644 --- a/m4/sys_types_h.m4 +++ b/m4/sys_types_h.m4 @@ -1,4 +1,4 @@ -# sys_types_h.m4 serial 1 +# sys_types_h.m4 serial 2 dnl Copyright (C) 2011 Free Software Foundation, Inc. dnl This file is free software; the Free Software Foundation dnl gives unlimited permission to copy and/or distribute it, @@ -11,6 +11,9 @@ AC_DEFUN([gl_SYS_TYPES_H], dnl Ensure the type pid_t gets defined. AC_REQUIRE([AC_TYPE_PID_T]) + + dnl Ensure the type mode_t gets defined. + AC_REQUIRE([AC_TYPE_MODE_T]) ]) AC_DEFUN([gl_SYS_TYPES_H_DEFAULTS], diff --git a/tests/test-fcntl-h.c b/tests/test-fcntl-h.c index f3520d148..7f350b46f 100644 --- a/tests/test-fcntl-h.c +++ b/tests/test-fcntl-h.c @@ -34,6 +34,7 @@ int i = FD_CLOEXEC; /* Check that the types are all defined. */ pid_t t1; off_t t2; +mode_t t3; int main (void) diff --git a/tests/test-sys_stat.c b/tests/test-sys_stat.c index 6e8178e9b..3303badcc 100644 --- a/tests/test-sys_stat.c +++ b/tests/test-sys_stat.c @@ -314,8 +314,9 @@ invalid UTIME macros /* Check the existence of some types. */ nlink_t t1; off_t t2; +mode_t t3; -struct timespec t3; +struct timespec st; int main (void) diff --git a/tests/test-sys_types.c b/tests/test-sys_types.c index b95706f1d..816c9d616 100644 --- a/tests/test-sys_types.c +++ b/tests/test-sys_types.c @@ -25,6 +25,7 @@ pid_t t1; size_t t2; ssize_t t3; off_t t4; +mode_t t5; int main (void) -- 2.11.0