Blame gl/msvc-nothrow.h

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