Message ID | 20191219000103.36667-4-cbiesinger@google.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 120375 invoked by alias); 19 Dec 2019 00:01:22 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 120038 invoked by uid 89); 19 Dec 2019 00:01:20 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-21.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.1 spammy=farm X-HELO: mail-ua1-f73.google.com Received: from mail-ua1-f73.google.com (HELO mail-ua1-f73.google.com) (209.85.222.73) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 19 Dec 2019 00:01:19 +0000 Received: by mail-ua1-f73.google.com with SMTP id 33so765221uaj.8 for <gdb-patches@sourceware.org>; Wed, 18 Dec 2019 16:01:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=1CBFXlM+STxMNiLvjANyuISwqGpC/aCYD9c0vEC82VE=; b=W3moNwUjzL5Ff17z5FbSs8cTp2pwkmLiRfD1AB3QosiHcUXzdFl7AjI6UGOphm9lU/ uZBWmHmO/8ANNBRpFQxaqRFIIlY9OyksixjUvfU05jUaNiJ08q2vYqOeCfQITnwCYgBl /PZgpymO35FaiKlkGeVxmRk0yhMyyokTrORbjeZng/Fvz3jgJ8jAQjyNXhkMHJLH9Gc7 R8f2MuPEOhi2RV80X/4Ca9onu4ULHEXKI16tdueEkvax+hTw2o59P0atZrEA0iTm4zBY 0o4liy0wb31DoTr2AFOaOYCzfPm8xadJCHdIrcn4T7101IettuHa5LNj+tnK2uvgZ4P6 L0Mw== Date: Wed, 18 Dec 2019 18:01:02 -0600 In-Reply-To: <20191219000103.36667-1-cbiesinger@google.com> Message-Id: <20191219000103.36667-4-cbiesinger@google.com> Mime-Version: 1.0 References: <20191219000103.36667-1-cbiesinger@google.com> Subject: [PATCH 2/3] Cast the log10 argument to double to disambiguate it From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org> Reply-To: Christian Biesinger <cbiesinger@google.com> To: gdb-patches@sourceware.org Cc: Christian Biesinger <cbiesinger@google.com> Content-Type: text/plain; charset="UTF-8" X-IsSubscribed: yes |
Commit Message
Terekhov, Mikhail via Gdb-patches
Dec. 19, 2019, 12:01 a.m. UTC
On Solaris 11 with gcc 5.5.0 (gcc211 on the compile farm), math.h has a using std::log10; directive. This is unfortunate because std::log10 has overloads for float/double/long double. To disambiguate this call, cast the argument to double to fix the build. Change-Id: I6c0c52e9c172b529c899a435d430e5916aeef69f --- gdb/tui/tui-source.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
> Date: Wed, 18 Dec 2019 18:01:02 -0600 > From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org> > Cc: Christian Biesinger <cbiesinger@google.com> > > On Solaris 11 with gcc 5.5.0 (gcc211 on the compile farm), math.h has a > using std::log10; directive. This is unfortunate because std::log10 has > overloads for float/double/long double. To disambiguate this call, > cast the argument to double to fix the build. We may wish to have a comment in the code referring to the original problem, including perhaps the OS and the compiler versions? Otherwise the need for this cast is not immediately obvious, IMO. Thanks.
>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes: >> Date: Wed, 18 Dec 2019 18:01:02 -0600 >> From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org> >> Cc: Christian Biesinger <cbiesinger@google.com> >> >> On Solaris 11 with gcc 5.5.0 (gcc211 on the compile farm), math.h has a >> using std::log10; directive. This is unfortunate because std::log10 has >> overloads for float/double/long double. To disambiguate this call, >> cast the argument to double to fix the build. Eli> We may wish to have a comment in the code referring to the original Eli> problem, including perhaps the OS and the compiler versions? Eli> Otherwise the need for this cast is not immediately obvious, IMO. Agreed; this is ok with that change. Tom
On Thu, Dec 19, 2019 at 12:17 PM Tom Tromey <tom@tromey.com> wrote: > > >>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes: > > >> Date: Wed, 18 Dec 2019 18:01:02 -0600 > >> From: "Christian Biesinger via gdb-patches" <gdb-patches@sourceware.org> > >> Cc: Christian Biesinger <cbiesinger@google.com> > >> > >> On Solaris 11 with gcc 5.5.0 (gcc211 on the compile farm), math.h has a > >> using std::log10; directive. This is unfortunate because std::log10 has > >> overloads for float/double/long double. To disambiguate this call, > >> cast the argument to double to fix the build. > > Eli> We may wish to have a comment in the code referring to the original > Eli> problem, including perhaps the OS and the compiler versions? > Eli> Otherwise the need for this cast is not immediately obvious, IMO. > > Agreed; this is ok with that change. OK, will push with this comment: /* Solaris 11+gcc 5.5 has ambiguous overloads of log10, so we cast to double to get the right one. */ Christian
diff --git a/gdb/tui/tui-source.c b/gdb/tui/tui-source.c index 32877d7bc8..1274e81674 100644 --- a/gdb/tui/tui-source.c +++ b/gdb/tui/tui-source.c @@ -85,7 +85,7 @@ tui_source_window::set_contents (struct gdbarch *arch, int digits = 0; if (compact_source) { - double l = log10 (offsets->size ()); + double l = log10 ((double) offsets->size ()); digits = 1 + (int) l; }