Blame lib/msvc-nothrow.h

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