Blame lib/msvc-nothrow.h

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