[PATCH] Come up with json::integer_number and use it in GCOV.
Martin Liška
mliska@suse.cz
Wed Jul 31 08:50:00 GMT 2019
Hi.
As seen here:
https://github.com/RPGillespie6/fastcov/pull/18/files/f184dd8b6fc14e075dfc0ea93de7be5c96298ddb#r308735088
GCOV uses json::number for branch count, line count and similar. However, the json library
uses a double as an internal representation for numbers. That's no desirable in case
of GCOV and so that I would like to come up with integer_number type.
David would you be fine with that?
Patch can bootstrap on x86_64-linux-gnu and survives regression tests.
Ready to be installed?
Thanks,
Martin
gcc/ChangeLog:
2019-07-31 Martin Liska <mliska@suse.cz>
* diagnostic-format-json.cc (json_from_expanded_location):
Use json::float_number.
* gcov.c (output_intermediate_json_line): Use new
json::integer_number.
(output_json_intermediate_file): Likewise.
* json.cc (number::print): Move to ...
(float_number::print): ... this.
(integer_number::print): New.
(test_writing_numbers): Move to ...
(test_writing_float_numbers): ... this.
(test_writing_integer_numbers): New.
(json_cc_tests): Register test_writing_integer_numbers.
* json.h (class value): Add forward declaration
for float_number and integer_number.
(enum kind): Add JSON_INTEGER and JSON_FLOAT.
(class number): Move to ...
(class float_number): ... this.
(class integer_number): New.
* optinfo-emit-json.cc (optrecord_json_writer::impl_location_to_json):
Use json::float_number.
(optrecord_json_writer::location_to_json): Likewise.
(optrecord_json_writer::profile_count_to_json): Likewise.
(optrecord_json_writer::pass_to_json): Likewise.
---
gcc/diagnostic-format-json.cc | 4 ++--
gcc/gcov.c | 23 +++++++++++---------
gcc/json.cc | 41 ++++++++++++++++++++++++++++-------
gcc/json.h | 35 ++++++++++++++++++++++++------
gcc/optinfo-emit-json.cc | 10 ++++-----
5 files changed, 81 insertions(+), 32 deletions(-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Come-up-with-json-integer_number-and-use-it-in-GCOV.patch
Type: text/x-patch
Size: 8906 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/gcc-patches/attachments/20190731/9a7b51ae/attachment.bin>
More information about the Gcc-patches
mailing list