Blame gettext-tools/gnulib-lib/msvc-nothrow.h

Packit Bot 06c835
/* Wrappers that don't throw invalid parameter notifications
Packit Bot 06c835
   with MSVC runtime libraries.
Packit Bot 06c835
   Copyright (C) 2011-2015 Free Software Foundation, Inc.
Packit Bot 06c835
Packit Bot 06c835
   This program is free software; you can redistribute it and/or modify
Packit Bot 06c835
   it under the terms of the GNU General Public License as published by
Packit Bot 06c835
   the Free Software Foundation; either version 3, or (at your option)
Packit Bot 06c835
   any later version.
Packit Bot 06c835
Packit Bot 06c835
   This program is distributed in the hope that it will be useful,
Packit Bot 06c835
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit Bot 06c835
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
Packit Bot 06c835
   GNU General Public License for more details.
Packit Bot 06c835
Packit Bot 06c835
   You should have received a copy of the GNU General Public License along
Packit Bot 06c835
   with this program; if not, see <http://www.gnu.org/licenses/>.  */
Packit Bot 06c835
Packit Bot 06c835
#ifndef _MSVC_NOTHROW_H
Packit Bot 06c835
#define _MSVC_NOTHROW_H
Packit Bot 06c835
Packit Bot 06c835
/* With MSVC runtime libraries with the "invalid parameter handler" concept,
Packit Bot 06c835
   functions like fprintf(), dup2(), or close() crash when the caller passes
Packit Bot 06c835
   an invalid argument.  But POSIX wants error codes (such as EINVAL or EBADF)
Packit Bot 06c835
   instead.
Packit Bot 06c835
   This file defines wrappers that turn such an invalid parameter notification
Packit Bot 06c835
   into an error code.  */
Packit Bot 06c835
Packit Bot 06c835
#if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
Packit Bot 06c835
Packit Bot 06c835
/* Get original declaration of _get_osfhandle.  */
Packit Bot 06c835
# include <io.h>
Packit Bot 06c835
Packit Bot 06c835
# if HAVE_MSVC_INVALID_PARAMETER_HANDLER
Packit Bot 06c835
Packit Bot 06c835
/* Override _get_osfhandle.  */
Packit Bot 06c835
extern intptr_t _gl_nothrow_get_osfhandle (int fd);
Packit Bot 06c835
#  define _get_osfhandle _gl_nothrow_get_osfhandle
Packit Bot 06c835
Packit Bot 06c835
# endif
Packit Bot 06c835
Packit Bot 06c835
#endif
Packit Bot 06c835
Packit Bot 06c835
#endif /* _MSVC_NOTHROW_H */