This is the mail archive of the 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]

[PR c/52952] More precise locations within format strings

This is a new version of the patch submitted here:

but handling (some) escape sequences.

I could not figure out a way to re-use the code from libcpp for this,
thus I implemented a simple function that given a string and offset in
bytes, it computes the visual column corresponding to that offset. The
function is very conservative: As soon as something unknown or
inconsistent is detected, it returns zero, thus preserving the current
behavior. This also preserves the current behavior for
non-concatenated tokens.

Bootstrapped and regression tested on x86_64-linux-gnu.



2015-05-20  Manuel LÃpez-IbÃÃez  <>

    PR c/52952
    * gcc.dg/redecl-4.c: Update column numbers.
    * gcc.dg/format/bitfld-1.c: Likewise.
    * gcc.dg/format/attr-2.c: Likewise.
    * gcc.dg/format/attr-6.c: Likewise.
    * gcc.dg/format/attr-7.c (baz): Likewise.
    * gcc.dg/format/asm_fprintf-1.c: Likewise.
    * gcc.dg/format/attr-4.c: Likewise.
    * gcc.dg/format/branch-1.c: Likewise.
    * gcc.dg/format/c90-printf-1.c: Likewise. Add tests for column
    locations within strings with embedded escape sequences.


2015-05-20  Manuel LÃpez-IbÃÃez  <>

    PR c/52952
    * c-format.c (location_column_from_byte_offset): New.
    (location_from_offset): New.
    (struct format_wanted_type): Add offset_loc field.
    (check_format_info): Move handling of location for extra arguments
    closer to the point of warning.
    (check_format_arg): Set offset_is_invalid.
    (check_format_info_main): Pass the result of location_from_offset
    to warning_at.
    (format_type_warning): Pass the result of location_from_offset
    to warning_at.

Attachment: format-loc-escapes.diff
Description: Text document

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