X-Git-Url: https://git.saurik.com/bison.git/blobdiff_plain/565a33db8fd3fd26aabca0a93693b266667ee6f3..d18f45311a8290ae86dd4a120f02c9d35c29970b:/src/location.h diff --git a/src/location.h b/src/location.h index 7e8fe61e..5a2d64a3 100644 --- a/src/location.h +++ b/src/location.h @@ -49,23 +49,27 @@ do { \ } while (0) -/* Output LOC on the stream OUT. */ +/* Output LOC on the stream OUT. + Warning: it uses quotearg's slot 3. */ # define LOCATION_PRINT(Out, Loc) \ do { \ - fprintf (stderr, "%s:", quotearg_style (escape_quoting_style, \ - (Loc).file)); \ - if ((Loc).first_line != (Loc).last_line) \ - fprintf (Out, "%d.%d-%d.%d", \ - (Loc).first_line, (Loc).first_column, \ - (Loc).last_line, (Loc).last_column - 1); \ - else if ((Loc).first_column < (Loc).last_column - 1) \ - fprintf (Out, "%d.%d-%d", (Loc).first_line, \ - (Loc).first_column, (Loc).last_column - 1); \ - else \ - fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \ + fprintf (stderr, "%s:", quotearg_n_style (3, escape_quoting_style, \ + (Loc).file)); \ + if ((Loc).first_line) \ + { \ + if ((Loc).first_line != (Loc).last_line) \ + fprintf (Out, "%d.%d-%d.%d", \ + (Loc).first_line, (Loc).first_column, \ + (Loc).last_line, (Loc).last_column - 1); \ + else if ((Loc).first_column < (Loc).last_column - 1) \ + fprintf (Out, "%d.%d-%d", (Loc).first_line, \ + (Loc).first_column, (Loc).last_column - 1); \ + else \ + fprintf (Out, "%d.%d", (Loc).first_line, (Loc).first_column); \ + } \ } while (0) - extern location_t empty_location; + #endif /* !LOCATION_H_ */