aboutsummaryrefslogtreecommitdiff
path: root/gcc/ada/treepr.adb
diff options
context:
space:
mode:
authorPiotr Trojanek <trojanek@adacore.com>2022-01-20 18:05:39 +0100
committerPierre-Marie de Rodat <derodat@adacore.com>2022-05-10 08:19:28 +0000
commit45c4d9193dd33013522ff7e7f8f90f77d20cb7be (patch)
tree8223f62aacf8b603688862ab8c2366dd91740f3f /gcc/ada/treepr.adb
parentce63a97b518915b3b6c1221da60af719c7eccd5a (diff)
downloadgcc-45c4d9193dd33013522ff7e7f8f90f77d20cb7be.zip
gcc-45c4d9193dd33013522ff7e7f8f90f77d20cb7be.tar.gz
gcc-45c4d9193dd33013522ff7e7f8f90f77d20cb7be.tar.bz2
[Ada] Remove repeated conversions between Source_Ptr and Int
Both Source_Ptr and Int are integer types (and even happen to have equal ranges). Their values can be calculated without converting back-and-forth, e.g.: Int (Loc1) - Int (Loc2) can be written simply as: Int (Loc1 - Loc2) Code cleanup related to handling of references to unset objects. Offending occurrences found with various invocations of grep. gcc/ada/ * par-ch10.adb, scng.adb, sem_res.adb, sinfo-utils.adb, treepr.adb: Simplify calculations with Source_Ptr and Loc values.
Diffstat (limited to 'gcc/ada/treepr.adb')
-rw-r--r--gcc/ada/treepr.adb2
1 files changed, 1 insertions, 1 deletions
diff --git a/gcc/ada/treepr.adb b/gcc/ada/treepr.adb
index 2faf3f8..3173668 100644
--- a/gcc/ada/treepr.adb
+++ b/gcc/ada/treepr.adb
@@ -1229,7 +1229,7 @@ package body Treepr is
else
Sfile := Get_Source_File_Index (Sloc (N));
- Print_Int (Int (Sloc (N)) - Int (Source_Text (Sfile)'First));
+ Print_Int (Int (Sloc (N) - Source_Text (Sfile)'First));
Write_Str (" ");
Write_Location (Sloc (N));
end if;