Blame src/gl/msvc-nothrow.h

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