]> git.ipfire.org Git - thirdparty/gcc.git/commit
[Ada] Use spans instead of locations for compiler diagnostics
authorYannick Moy <moy@adacore.com>
Mon, 7 Dec 2020 15:45:23 +0000 (16:45 +0100)
committerPierre-Marie de Rodat <derodat@adacore.com>
Wed, 28 Apr 2021 09:38:08 +0000 (05:38 -0400)
commit9d5f3b7a694ceb774330d45894b38e34bb90f86a
treef9755e604cf4629f136eec728632b29475f8d069
parentae77b299e9717e3a76ac6b7be65145a50aa31ed2
[Ada] Use spans instead of locations for compiler diagnostics

gcc/ada/

* errout.adb: (Error_Msg_Internal): Use span instead of
location.
(Error_Msg, Error_Msg_NEL): Add versions with span parameter.
(Error_Msg_F, Error_Msg_FE, Error_Msg_N, Error_Msg_NE,
Error_Msg_NW): Retrieve span from node.
(First_Node): Use the new First_And_Last_Nodes.
(First_And_Last_Nodes): Expand on previous First_Node. Apply to
other nodes than expressions.
(First_Sloc): Protect against inconsistent locations.
(Last_Node): New function based on First_And_Last_Nodes.
(Last_Sloc): New function similar to First_Sloc.
(Output_Messages): Update output when -gnatdF is used. Use
character ~ for making the span visible, similar to what is done
in GCC and Clang.
* errout.ads (Error_Msg, Error_Msg_NEL): Add versions with span
parameter.
(First_And_Last_Nodes, Last_Node, Last_Sloc): New subprograms.
* erroutc.adb: Adapt to Sptr field being a span.
* erroutc.ads (Error_Msg_Object): Change field Sptr from
location to span.
* errutil.adb: Adapt to Sptr field being a span.
* freeze.adb: Use Errout reporting procedures for nodes to get
spans.
* par-ch3.adb: Likewise.
* par-prag.adb: Likewise.
* par-util.adb: Likewise.
* sem_case.adb: Likewise.
* sem_ch13.adb: Likewise.
* sem_ch3.adb: Likewise.
* sem_prag.adb: Likewise.
* types.ads: (Source_Span): New type for spans.
(To_Span): Basic constructors for spans.
14 files changed:
gcc/ada/errout.adb
gcc/ada/errout.ads
gcc/ada/erroutc.adb
gcc/ada/erroutc.ads
gcc/ada/errutil.adb
gcc/ada/freeze.adb
gcc/ada/par-ch3.adb
gcc/ada/par-prag.adb
gcc/ada/par-util.adb
gcc/ada/sem_case.adb
gcc/ada/sem_ch13.adb
gcc/ada/sem_ch3.adb
gcc/ada/sem_prag.adb
gcc/ada/types.ads