Revert "Update gnulib to current upstream master"
[deliverable/binutils-gdb.git] / gdb / gnulib / import / error.c
index adc873391cb49e164297fd1d9f16ca0aedcf1e60..b3b1286a350b1c24a853cf141818f54bb623ab5e 100644 (file)
@@ -1,5 +1,5 @@
 /* Error handler for noninteractive utilities
-   Copyright (C) 1990-1998, 2000-2007, 2009-2018 Free Software Foundation, Inc.
+   Copyright (C) 1990-1998, 2000-2007, 2009-2016 Free Software Foundation, Inc.
    This file is part of the GNU C Library.
 
    This program is free software: you can redistribute it and/or modify
@@ -13,7 +13,7 @@
    GNU General Public License for more details.
 
    You should have received a copy of the GNU General Public License
-   along with this program.  If not, see <https://www.gnu.org/licenses/>.  */
+   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
 /* Written by David MacKenzie <djm@gnu.ai.mit.edu>.  */
 
@@ -93,37 +93,33 @@ extern void __error_at_line (int status, int errnum, const char *file_name,
 # include <fcntl.h>
 # include <unistd.h>
 
-# if defined _WIN32 && ! defined __CYGWIN__
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
 /* Get declarations of the native Windows API functions.  */
 #  define WIN32_LEAN_AND_MEAN
 #  include <windows.h>
 /* Get _get_osfhandle.  */
-#  if GNULIB_MSVC_NOTHROW
-#   include "msvc-nothrow.h"
-#  else
-#   include <io.h>
-#  endif
+#  include "msvc-nothrow.h"
 # endif
 
 /* The gnulib override of fcntl is not needed in this file.  */
 # undef fcntl
 
-# if !(GNULIB_STRERROR_R_POSIX || HAVE_DECL_STRERROR_R)
+# if !HAVE_DECL_STRERROR_R
 #  ifndef HAVE_DECL_STRERROR_R
 "this configure-time declaration test was not run"
 #  endif
 #  if STRERROR_R_CHAR_P
-char *strerror_r (int errnum, char *buf, size_t buflen);
+char *strerror_r ();
 #  else
-int strerror_r (int errnum, char *buf, size_t buflen);
+int strerror_r ();
 #  endif
 # endif
 
 #define program_name getprogname ()
 
-# if GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r
+# if HAVE_STRERROR_R || defined strerror_r
 #  define __strerror_r strerror_r
-# endif /* GNULIB_STRERROR_R_POSIX || HAVE_STRERROR_R || defined strerror_r */
+# endif /* HAVE_STRERROR_R || defined strerror_r */
 #endif  /* not _LIBC */
 
 #if !_LIBC
@@ -131,7 +127,7 @@ int strerror_r (int errnum, char *buf, size_t buflen);
 static int
 is_open (int fd)
 {
-# if defined _WIN32 && ! defined __CYGWIN__
+# if (defined _WIN32 || defined __WIN32__) && ! defined __CYGWIN__
   /* On native Windows: The initial state of unassigned standard file
      descriptors is that they are open but point to an INVALID_HANDLE_VALUE.
      There is no fcntl, and the gnulib replacement fcntl does not support
@@ -176,9 +172,9 @@ print_errno_message (int errnum)
 {
   char const *s;
 
-#if _LIBC || GNULIB_STRERROR_R_POSIX || defined HAVE_STRERROR_R
+#if defined HAVE_STRERROR_R || _LIBC
   char errbuf[1024];
-# if _LIBC || (!GNULIB_STRERROR_R_POSIX && STRERROR_R_CHAR_P)
+# if _LIBC || STRERROR_R_CHAR_P
   s = __strerror_r (errnum, errbuf, sizeof errbuf);
 # else
   if (__strerror_r (errnum, errbuf, sizeof errbuf) == 0)
@@ -272,6 +268,7 @@ error_tail (int status, int errnum, const char *message, va_list args)
   else
 #endif
     vfprintf (stderr, message, args);
+  va_end (args);
 
   ++error_message_count;
   if (errnum)
@@ -321,7 +318,6 @@ error (int status, int errnum, const char *message, ...)
 
   va_start (args, message);
   error_tail (status, errnum, message, args);
-  va_end (args);
 
 #ifdef _LIBC
   _IO_funlockfile (stderr);
@@ -392,7 +388,6 @@ error_at_line (int status, int errnum, const char *file_name,
 
   va_start (args, message);
   error_tail (status, errnum, message, args);
-  va_end (args);
 
 #ifdef _LIBC
   _IO_funlockfile (stderr);
This page took 0.026716 seconds and 4 git commands to generate.