[RFC/patch] New iteration at fixing 9533

Nathan Myers ncm-nospam@cantrip.org
Sun Mar 23 10:07:00 GMT 2003


On Sat, Mar 22, 2003 at 08:03:18PM +0100, Paolo Carlini wrote:
> 
> this is the second try.
> ...
> +dnl
> +dnl Check whether S_ISREG (Posix) or S_IFREG is available in <sys/stat.h>.
> +dnl
> +
> +AC_DEFUN(GLIBCPP_CHECK_S_ISREG_OR_S_IFREG, [
> ...
> +  AC_CACHE_VAL(glibcpp_cv_S_IFREG, [
> +    AC_TRY_LINK([#include <sys/stat.h>],
> +                [struct stat buffer; fstat(0, &buffer); S_IFREG(buffer.st_mode); ],
> +                [glibcpp_cv_S_IFREG=yes],
> +                [glibcpp_cv_S_IFREG=no])
> +  ])
> +  if test x$glibcpp_cv_S_ISREG = xyes; then
> +    AC_DEFINE(_GLIBCPP_S_ISREG_OR_S_IFREG, S_ISREG)
> +  elif test x$glibcpp_cv_S_IFREG = xyes; then
> +    AC_DEFINE(_GLIBCPP_S_ISREG_OR_S_IFREG, S_IFREG)
> +  fi
> +])

I think S_IFREG is a regular numeric constant, so we should be testing
the expression (S_IFREG & buffer.st_mode), and the macro should (somehow) 
end up as "#define _GLIBCPP_S_ISREG_OR_S_IFREG(m) (S_IFREG & (m))".  
Maybe that's

   AC_DEFINE(_GLIBCPP_S_ISREG_OR_S_IFREG(m), (S_IFREG & (m)))

Nathan Myers
ncm-nospam@cantrip.org



More information about the Libstdc++ mailing list