From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Subject: [PATCH] remove unneeded BSD & Solaris compatibility layer Date: Sun, 28 Jun 2020 11:09:04 +0200 [thread overview] Message-ID: <20200628090904.69011-1-luc.vanoostenryck@gmail.com> (raw) None of the BSDs need "compat-bsd.c" anymore. Same for Solaris and "compat-solaris.c", even for Solaris 10. The only problem was lacking C99's strtold() but it seems that this was solved many years ago and they're all doing quite fine with "compat-linux.c". So, simply replace the content of these file by an include of "compat-linux.c". Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- compat-bsd.c | 14 +------------- compat-solaris.c | 34 +--------------------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/compat-bsd.c b/compat-bsd.c index d8acf40b1dcb..43c716ca2f87 100644 --- a/compat-bsd.c +++ b/compat-bsd.c @@ -21,16 +21,4 @@ * THE SOFTWARE. */ -#include <sys/types.h> -#include <string.h> - -#include "lib.h" -#include "allocate.h" -#include "token.h" - -#include "compat/mmap-blob.c" - -long double string_to_ld(const char *nptr, char **endptr) -{ - return strtod(nptr, endptr); -} +#include "compat-linux.c" diff --git a/compat-solaris.c b/compat-solaris.c index 7253a892d50d..58bc43387c60 100644 --- a/compat-solaris.c +++ b/compat-solaris.c @@ -1,33 +1 @@ -#include "lib.h" -#include "allocate.h" - -#include "compat/mmap-blob.c" - -#include <floatingpoint.h> -#include <limits.h> -#include <errno.h> - -long double string_to_ld(const char *str, char **endptr) -{ - long double res; - decimal_record dr; - enum decimal_string_form form; - decimal_mode dm; - fp_exception_field_type excp; - char *echar; - - string_to_decimal ((char **)&str, INT_MAX, 0, - &dr, &form, &echar); - if (endptr) *endptr = (char *)str; - - if (form == invalid_form) { - errno = EINVAL; - return 0.0; - }
WARNING: multiple messages have this Message-ID (diff)
From: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> To: linux-sparse@vger.kernel.org Cc: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> Subject: [PATCH] remove unneeded BSD & Solaris compatibility layer Date: Sun, 28 Jun 2020 11:09:04 +0200 [thread overview] Message-ID: <20200628090904.69011-1-luc.vanoostenryck@gmail.com> (raw) Message-ID: <20200628090904.W4eHMlf8DqXDOXm0wIiucn-aEdHJ-WRxPkggw1QvE5Y@z> (raw) None of the BSDs need "compat-bsd.c" anymore. Same for Solaris and "compat-solaris.c", even for Solaris 10. The only problem was lacking C99's strtold() but it seems that this was solved many years ago and they're all doing quite fine with "compat-linux.c". So, simply replace the content of these file by an include of "compat-linux.c". Signed-off-by: Luc Van Oostenryck <luc.vanoostenryck@gmail.com> --- compat-bsd.c | 14 +------------- compat-solaris.c | 34 +--------------------------------- 2 files changed, 2 insertions(+), 46 deletions(-) diff --git a/compat-bsd.c b/compat-bsd.c index d8acf40b1dcb..43c716ca2f87 100644 --- a/compat-bsd.c +++ b/compat-bsd.c @@ -21,16 +21,4 @@ * THE SOFTWARE. */ -#include <sys/types.h> -#include <string.h> - -#include "lib.h" -#include "allocate.h" -#include "token.h" - -#include "compat/mmap-blob.c" - -long double string_to_ld(const char *nptr, char **endptr) -{ - return strtod(nptr, endptr); -} +#include "compat-linux.c" diff --git a/compat-solaris.c b/compat-solaris.c index 7253a892d50d..58bc43387c60 100644 --- a/compat-solaris.c +++ b/compat-solaris.c @@ -1,33 +1 @@ -#include "lib.h" -#include "allocate.h" - -#include "compat/mmap-blob.c" - -#include <floatingpoint.h> -#include <limits.h> -#include <errno.h> - -long double string_to_ld(const char *str, char **endptr) -{ - long double res; - decimal_record dr; - enum decimal_string_form form; - decimal_mode dm; - fp_exception_field_type excp; - char *echar; - - string_to_decimal ((char **)&str, INT_MAX, 0, - &dr, &form, &echar); - if (endptr) *endptr = (char *)str; - - if (form == invalid_form) { - errno = EINVAL; - return 0.0; - } - - dm.rd = fp_nearest; - decimal_to_quadruple (&res, &dm, &dr, &excp); - if (excp & ((1 << fp_overflow) | (1 << fp_underflow))) - errno = ERANGE; - return res; -} +#include "compat-linux.c" -- 2.27.0
next reply other threads:[~2020-06-28 9:09 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-06-28 9:09 Luc Van Oostenryck [this message] 2020-06-28 9:09 ` [PATCH] remove unneeded BSD & Solaris compatibility layer Luc Van Oostenryck
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=20200628090904.69011-1-luc.vanoostenryck@gmail.com \ --to=luc.vanoostenryck@gmail.com \ --cc=linux-sparse@vger.kernel.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: linkBe 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 NNTP newsgroup(s).