gdb: Use std::abs instead of abs on LONGEST types
authorAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 27 Feb 2020 16:42:17 +0000 (16:42 +0000)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Thu, 27 Feb 2020 16:45:34 +0000 (16:45 +0000)
Use std::abs so that we get the C++ overloaded version that matches
the argument type instead of the C abs function which is only for int
arguments.

There should be no user visible change after this commit.

gdb/ChangeLog:

* gdbtypes.c (create_array_type_with_stride): Use std::abs not
abs.

gdb/ChangeLog
gdb/gdbtypes.c

index 2f92b0a7cd54d040cdd64f1bed5c022b38821297..4376161673bf5c5b10264f7bb1f6a8ff1f14f31a 100644 (file)
@@ -1,3 +1,8 @@
+2020-02-27  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * gdbtypes.c (create_array_type_with_stride): Use std::abs not
+       abs.
+
 2020-02-26  Tom Tromey  <tom@tromey.com>
 
        * dwarf2/read.c (struct dwarf2_include_psymtab): New.
index ef110b30445f82cc464240a2ed55e3ce08500729..d89df9f7409a003cd04f059bf4ab84399d7b74fd 100644 (file)
@@ -1249,9 +1249,9 @@ create_array_type_with_stride (struct type *result_type,
             negative stride in Fortran (this doesn't mean anything
             special, it's still just a single element array) so do
             consider that case when touching this code.  */
-         LONGEST element_count = abs (high_bound - low_bound + 1);
+         LONGEST element_count = std::abs (high_bound - low_bound + 1);
          TYPE_LENGTH (result_type)
-           = ((abs (stride) * element_count) + 7) / 8;
+           = ((std::abs (stride) * element_count) + 7) / 8;
        }
       else
        TYPE_LENGTH (result_type) =