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] |
On 11/08/2017 06:03 AM, Martin Liška wrote:
On 11/07/2017 03:49 PM, Nathan Sidwell wrote:On 11/07/2017 05:53 AM, Martin Liška wrote:Hello. This is slightly updated version from the previous. Various small issues were fixed and I update documentation in order to reflect the changes.+ gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl)); gcov_write_filename (xloc.file); gcov_write_unsigned (xloc.line); + gcov_write_unsigned (expand_location (cfun->function_end_locus).line); gcov_write_length (offset);this is presuming the end line is in the same file as the start line. A reasonable assumption, but users can have exciting ideas! What is the failure mode if the function straddles a file boundary?Hi. I decided to fix that with change that set line_end = line_start if line_end < line_start. That survives reasonably well with cases like this:
+ gcov_write_unsigned (DECL_ARTIFICIAL (current_function_decl)); gcov_write_filename (xloc.file); gcov_write_unsigned (xloc.line); + gcov_write_unsigned (xloc.column); + + /* Function can start in a single file and end in another one. */ + int fn_end_line = expand_location (cfun->function_end_locus).line; + gcov_write_unsigned (fn_end_line > xloc.line ? fn_end_line : xloc.line);
sorry to be picky, but of course the end line could be greater than the start. but in a different file. Please check file too.
This isn't stable if they start on the same line. Will output order depend on the vaguaries of the sorting algorithm?+ vector<line_info> &lines = (*it2)->lines; + /* Print all lines covered by the function. */ + for (unsigned i = 0; i < lines.size (); i++)So fixed by introduction of line column that is used for sorting as well.
thanks.
May I understand the reply as ACK?
Patch ok, with the above check for file names added. nathan -- Nathan Sidwell
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |