gdb: Force use of float version of log10
authorAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 13 Sep 2019 01:23:37 +0000 (21:23 -0400)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Fri, 13 Sep 2019 01:23:37 +0000 (21:23 -0400)
This commit:

  commit aa17805fb9a3a1983a510ba425b682fba03410c2
  Date:   Sat Aug 31 23:44:40 2019 +0100

      gdb: Have 'maint info sections' print all sections again

introduced a use of log10 that took an int as a parameter.
Unfortunately this was causing a compilation error on Solaris, see:

  https://sourceware.org/ml/gdb-patches/2019-09/msg00230.html
  https://sourceware.org/ml/gdb-patches/2019-09/msg00231.html

because there was only a float, double, or long double version of
log10, and the compiler doesn't know which to choose.

This commit should resolve this issue by casting the argument to
float.

gdb/ChangeLog:

* maint.c (maint_print_section_data::maint_print_section_data):
Force use of 'float log10 (float)' by casting the argument to
float.

gdb/ChangeLog
gdb/maint.c

index 4158161393e3472ecf88904a6388f9e55abafd1c..147882447e23e17813ce20c14a298c994768fced 100644 (file)
@@ -1,3 +1,9 @@
+2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * maint.c (maint_print_section_data::maint_print_section_data):
+       Force use of 'float log10 (float)' by casting the argument to
+       float.
+
 2019-09-12  Andrew Burgess  <andrew.burgess@embecosm.com>
 
        * maint.c: Add 'cmath' include.
index 286ec31013571b661f166a4666c9bfee30318dad..1a621a17191f89e83805898accb356a5a4733163 100644 (file)
@@ -301,7 +301,7 @@ struct maint_print_section_data
       arg(arg)
   {
     int section_count = gdb_bfd_count_sections (abfd);
-    index_digits = ((int) log10 (section_count)) + 1;
+    index_digits = ((int) log10 ((float) section_count)) + 1;
   }
 
 private:
This page took 0.028969 seconds and 4 git commands to generate.