public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
From: "Gabriel F. T. Gomes" <gabriel@inconstante.net.br>
To: <libc-alpha@sourceware.org>
Subject: [PATCH 11/31] ldbl-128ibm-compat: Add error.h functions
Date: Tue, 15 Oct 2019 19:06:00 -0000	[thread overview]
Message-ID: <20191015190529.11559-12-gabriel@inconstante.net.br> (raw)
In-Reply-To: <20191015190529.11559-1-gabriel@inconstante.net.br>

From: "Gabriel F. T. Gomes" <gabrielftg@linux.ibm.com>

Use the recently added, internal functions, __error_at_line_internal and
__error_internal, to provide error.h functions that can take long double
arguments with IEEE binary128 format on platforms where long double can
also take double format or some non-IEEE format (currently, this means
powerpc64le).

Tested for powerpc64le.
---
 misc/errorP.h                                 | 28 ++++++++++
 sysdeps/ieee754/ldbl-128ibm-compat/Makefile   |  3 +-
 sysdeps/ieee754/ldbl-128ibm-compat/Versions   |  3 ++
 .../ldbl-128ibm-compat/ieee128-error.c        | 51 +++++++++++++++++++
 4 files changed, 84 insertions(+), 1 deletion(-)
 create mode 100644 misc/errorP.h
 create mode 100644 sysdeps/ieee754/ldbl-128ibm-compat/ieee128-error.c

diff --git a/misc/errorP.h b/misc/errorP.h
new file mode 100644
index 0000000000..c61c49cd61
--- /dev/null
+++ b/misc/errorP.h
@@ -0,0 +1,28 @@
+/* Prototypes for internal error.h functions.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdarg.h>
+
+void
+__error_internal (int status, int errnum, const char *message,
+		  va_list args, unsigned int mode_flags);
+
+void
+__error_at_line_internal (int status, int errnum, const char *file_name,
+			  unsigned int line_number, const char *message,
+			  va_list args, unsigned int mode_flags);
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
index 6bb0bed2fc..a09209a2dd 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Makefile
@@ -175,7 +175,8 @@ CFLAGS-tst-ibm128-argp.c += -mabi=ibmlongdouble -Wno-psabi
 endif
 
 ifeq ($(subdir),misc)
-ldbl-extra-routines += err
+ldbl-extra-routines += err \
+		       error
 endif
 
 # Add IEEE binary128 files as make targets.
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/Versions b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
index e2b3dda551..dead38cdcb 100644
--- a/sysdeps/ieee754/ldbl-128ibm-compat/Versions
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/Versions
@@ -192,5 +192,8 @@ libc {
     __errxieee128;
     __verrieee128;
     __verrxieee128;
+
+    __errorieee128;
+    __error_at_lineieee128;
   }
 }
diff --git a/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-error.c b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-error.c
new file mode 100644
index 0000000000..9c74e060d7
--- /dev/null
+++ b/sysdeps/ieee754/ldbl-128ibm-compat/ieee128-error.c
@@ -0,0 +1,51 @@
+/* Wrappers for error.h functions.  IEEE128 version.
+   Copyright (C) 2018 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <http://www.gnu.org/licenses/>.  */
+
+#include <stdarg.h>
+#include <misc/errorP.h>
+#include <libio/libioP.h>
+
+#define IEEE128_ALIAS(name) \
+  strong_alias (___ieee128_##name, __##name##ieee128)
+
+#define IEEE128_DECL(name) ___ieee128_##name
+
+void
+IEEE128_DECL (error) (int status, int errnum, const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  __error_internal (status, errnum, message, ap,
+		    PRINTF_LDBL_USES_FLOAT128);
+  va_end (ap);
+}
+IEEE128_ALIAS (error)
+
+void
+IEEE128_DECL (error_at_line) (int status, int errnum,
+			      const char *file_name,
+			      unsigned int line_number,
+			      const char *message, ...)
+{
+  va_list ap;
+  va_start (ap, message);
+  __error_at_line_internal (status, errnum, file_name, line_number,
+			    message, ap, PRINTF_LDBL_USES_FLOAT128);
+  va_end (ap);
+}
+IEEE128_ALIAS (error_at_line)
-- 
2.21.0

  parent reply	other threads:[~2019-10-15 19:06 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15 19:05 [PATCH 00/31] Add IEEE long double <-> string functions for powerpc64le Gabriel F. T. Gomes
2019-10-15 19:05 ` [PATCH 02/31] ldbl-128ibm-compat: Add wide character printing functions Gabriel F. T. Gomes
2019-10-15 19:05 ` [PATCH 01/31] ldbl-128ibm-compat: Add regular " Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 07/31] ldbl-128ibm-compat: Add regular character scanning functions Gabriel F. T. Gomes
2019-10-15 19:06 ` Gabriel F. T. Gomes [this message]
2019-10-15 19:06 ` [PATCH 06/31] ldbl-128ibm-compat: Test positional arguments Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 10/31] ldbl-128ibm-compat: Add err.h functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 05/31] ldbl-128ibm-compat: Test double values Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 03/31] ldbl-128ibm-compat: Add regular character, fortified printing functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 04/31] ldbl-128ibm-compat: Add wide " Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 08/31] ldbl-128ibm-compat: Add wide character scanning functions Gabriel F. T. Gomes
2019-10-15 19:06 ` [PATCH 12/31] ldbl-128ibm-compat: Reuse tests for err.h and error.h functions Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 23/31] Refactor *cvt functions implementation (4/5) Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 17/31] ldbl-128ibm-compat: Add tests for strfmon and strfmon_l Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 20/31] Refactor *cvt functions implementation (1/5) Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 14/31] ldbl-128ibm-compat: Add obstack printing functions Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 13/31] ldbl-128ibm-compat: Add ISO C99 versions of scanf functions Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 19/31] Remove hidden_def and hidden_proto from cvt functions Gabriel F. T. Gomes
2019-10-21  1:55   ` Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 18/31] ldbl-128ibm-compat: Add tests for strfroml, strtold, and wcstold Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 15/31] ldbl-128ibm-compat: Add syslog functions Gabriel F. T. Gomes
2019-10-15 20:59   ` Joseph Myers
2019-10-21  1:51     ` Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 09/31] ldbl-128ibm-compat: Add argp_error and argp_failure Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 16/31] ldbl-128ibm-compat: Add strfmon_l with IEEE long double format Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 22/31] Refactor *cvt functions implementation (3/5) Gabriel F. T. Gomes
2019-10-15 19:07 ` [PATCH 21/31] Refactor *cvt functions implementation (2/5) Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 27/31] ldbl-128ibm-compat: Compiler flags for stdio functions Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 30/31] powerpc64le: Require a compiler with -mno-gnu-attribute Gabriel F. T. Gomes
2019-10-15 21:11   ` Joseph Myers
2019-10-15 19:08 ` [PATCH 31/31] RFC: powerpc64le: Enable support for IEEE long double Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 24/31] Refactor *cvt functions implementation (5/5) Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 28/31] Avoid compat symbols for totalorder in powerpc64le IEEE long double Gabriel F. T. Gomes
2019-10-15 21:08   ` Joseph Myers
2019-10-21  1:50     ` Gabriel F. T. Gomes
2019-10-21 14:59       ` Joseph Myers
2019-10-15 19:08 ` [PATCH 29/31] ldbl-128ibm-compat: Do not mix -mabi=*longdouble and -mlong-double-128 Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 25/31] ldbl-128ibm-compat: Add *cvt functions Gabriel F. T. Gomes
2019-10-15 19:08 ` [PATCH 26/31] Do not redirect calls to __GI_* symbols, when redirecting to *ieee128 Gabriel F. T. Gomes
2019-10-16  3:57   ` Florian Weimer
2019-10-21  1:49     ` Gabriel F. T. Gomes
2019-10-21 10:13       ` Florian Weimer

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191015190529.11559-12-gabriel@inconstante.net.br \
    --to=gabriel@inconstante.net.br \
    --cc=libc-alpha@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).