This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[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.

Tested on x86_64-pc-linux-gnu, committed on trunk

2019-07-11  Eric Botcazou  <ebotcazou@adacore.com>

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.

Attachment: patch.diff.gz
Description: application/gzip


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]