[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MSVC compiler support [patch 7]: mkdir number of arguments
From: |
Michael Goffioul |
Subject: |
Re: MSVC compiler support [patch 7]: mkdir number of arguments |
Date: |
Wed, 18 Oct 2006 14:11:08 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (Windows/20060909) |
John W. Eaton a écrit :
I would prefer to fix the test to make it work, so I'm not applying
this patch.
How does the current test fail? I think the only place that this
macro is used is liboctave/file-ops.cc. Does that file fail to
compile if MKDIR_TAKES_ONE_ARG is not defined? If so, what is the
error?
The problem is that the test is done in C mode, while the code using it
is C++. Under MSVC,
calling mkdir with 2 arguments in C mode only produces a warning, not a
compilation error.
This is why the actual test does not work. I can understand the warning
as calling a C function
with more arguments than expected is not as harmful as calling it with
less arguments.
I can see 2 solutions:
1) do the test in the other way by testing mkdir() with one argument:
this should produce an
error when 2 are required
2) switch to C++ mode when doing the test (see patch attached, it works OK)
Michael.
Index: aclocal.m4
===================================================================
RCS file: /cvs/octave/aclocal.m4,v
retrieving revision 1.98
diff -c -r1.98 aclocal.m4
*** aclocal.m4 18 Oct 2006 02:02:36 -0000 1.98
--- aclocal.m4 18 Oct 2006 12:04:58 -0000
***************
*** 784,791 ****
dnl
dnl Determine if mkdir accepts only one argument instead dnl of the usual 2.
dnl
! AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG,
! [AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
--- 787,795 ----
dnl
dnl Determine if mkdir accepts only one argument instead dnl of the usual 2.
dnl
! AC_DEFUN(OCTAVE_MKDIR_TAKES_ONE_ARG, [
! AC_LANG_PUSH(C++)
! AC_CACHE_CHECK([if mkdir takes one argument], octave_cv_mkdir_takes_one_arg,
[AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[#include <sys/types.h>
#ifdef HAVE_SYS_STAT_H
# include <sys/stat.h>
***************
*** 797,802 ****
--- 801,807 ----
# include <direct.h>
#endif]], [[mkdir ("foo", 0);]])],
octave_cv_mkdir_takes_one_arg=no, octave_cv_mkdir_takes_one_arg=yes)])
+ AC_LANG_POP(C++)
if test $octave_cv_mkdir_takes_one_arg = yes ; then
AC_DEFINE(MKDIR_TAKES_ONE_ARG, 1, [Define if host mkdir takes a single
argument.])
fi
- MSVC compiler support [patch 4]: sepchar definition, (continued)
- MSVC compiler support [patch 5]: Additional required definition, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 5]: Additional required definition, John W. Eaton, 2006/10/26
- MSVC compiler support [patch 6]: Default program definition, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 6]: Default program definition, John W. Eaton, 2006/10/17
- Re: MSVC compiler support [patch 6]: Default program definition, Michael Goffioul, 2006/10/18
- Re: MSVC compiler support [patch 6]: Default program definition, John W. Eaton, 2006/10/26
- MSVC compiler support [patch 7]: mkdir number of arguments, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 7]: mkdir number of arguments, John W. Eaton, 2006/10/17
- Re: MSVC compiler support [patch 7]: mkdir number of arguments,
Michael Goffioul <=
- Re: MSVC compiler support [patch 7]: mkdir number of arguments, John W. Eaton, 2006/10/26
- MSVC compiler support [patch 8]: isnan, finite and copysign, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 8]: isnan, finite and copysign, John W. Eaton, 2006/10/17
- Re: MSVC compiler support [patch 8]: isnan, finite and copysign, Michael Goffioul, 2006/10/18
- MSVC compiler support [patch 9]: Default object suffix, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 9]: Default object suffix, John W. Eaton, 2006/10/17
- MSVC compiler support [patch 10]: .oct file compilation, Michael Goffioul, 2006/10/17
- MSVC compiler support [patch 10]: .oct file compilation, John W. Eaton, 2006/10/17
- Re: MSVC compiler support [patch 10]: .oct file compilation, Michael Goffioul, 2006/10/18
- Re: MSVC compiler support [patch 10]: .oct file compilation, John W. Eaton, 2006/10/24