From 6c1657116a2c9cf7c0c14b6dfa7f8bbb7672d3c8 Mon Sep 17 00:00:00 2001 From: Eric Botcazou Date: Thu, 11 Jul 2019 08:01:35 +0000 Subject: [Ada] New Repinfo.Input unit to read back JSON representation info. For some time the Repinfo unit has been able to output the representation information in the JSON data interchange format in addition to the usual text and binary formats. The new Repinfo.Input unit makes it possible to read back this information under this format and make it available to clients, the main one being ASIS. The big advantage of using this approach over manipulating a binary blob is that the writer and the reader of the JSON representation need not be binary compatible, i.e. in practice need not be the same version of the compiler or ASIS for the same target. The patch also adds a -gnatd_j switch to read back the information in the compiler itself, which makes it easy to keep the writer and the reader in sync using only one tool, namely the compiler. The typical usage is: gcc -c p.ads -gnatR4js gcc -c p.ads -gnatd_j to exercise respectively the writer and the reader from the compiler. 2019-07-11 Eric Botcazou gcc/ada/ * alloc.ads (Rep_JSON_Table_Initial): New constant. (Rep_JSON_Table_Increment): Likewise. * debug.adb: Document -gnatd_j switch. * gcc-interface/Make-lang.in (GNAT_ADA_OBJS): Add repinfo-input.o. * gnat1drv.adb: Add with clause for Repinfo.Input. Add with and use clauses for Sinput. (Read_JSON_Files_For_Repinfo): New procedure. (Gnat1drv1): Deal with -gnatd_j switch. * repinfo-input.ad[sb]: New unit. * snames.ads-tmpl (Name_Discriminant): New constant. (Name_Operands): Likewise. From-SVN: r273382 --- gcc/ada/debug.adb | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'gcc/ada/debug.adb') diff --git a/gcc/ada/debug.adb b/gcc/ada/debug.adb index 44f0b9e..6df3d6f 100644 --- a/gcc/ada/debug.adb +++ b/gcc/ada/debug.adb @@ -154,7 +154,7 @@ package body Debug is -- d_g -- d_h -- d_i Ignore activations and calls to instances for elaboration - -- d_j + -- d_j Read JSON files and populate Repinfo tables (opposite of -gnatRjs) -- d_k -- d_l -- d_m @@ -988,6 +988,10 @@ package body Debug is -- subprogram or task type defined in an external instance for both -- the static and dynamic elaboration models. + -- d_j The compiler reads JSON files that would be generated by the same + -- compilation session if -gnatRjs was passed, in order to populate + -- the internal tables of the Repinfo unit from them. + -- d_p The compiler ignores calls to subprograms which verify the run-time -- semantics of invariants and postconditions in both the static and -- dynamic elaboration models. -- cgit v1.1