Blame lib/msvc-nothrow.h

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