-/* --- @report_location@ --- *
- *
- * Arguments: @struct human_output *h@ = output state
- * @FILE *fp@ = stream to write the location on
- * @const char *file@ = filename
- * @unsigned lno@ = line number
- *
- * Returns: ---
- *
- * Use: Print the filename and line number to the output stream @fp@.
- * Also, if appropriate, print interleaved highlighting control
- * codes to our usual output stream. If @file@ is null then do
- * nothing.
- */
-
-static void report_location(struct human_output *h, FILE *fp,
- const char *file, unsigned lno)
-{
- unsigned f = 0;
-#define f_flush 1u
-
- /* We emit highlighting if @fp@ is our usual output stream, or the
- * duplicate-errors flag is clear indicating that (we assume) they're
- * secretly going to the same place anyway. If they're different streams,
- * though, we have to be careful to keep the highlighting and the actual
- * text synchronized.
- */
-
- if (!file)
- /* nothing to do */;
- else if (fp != h->lyt.fp && (h->f&HOF_DUPERR))
- fprintf(fp, "%s:%u: ", file, lno);
- else {
- if (fp != h->lyt.fp) f |= f_flush;
-
-#define FLUSH(fp) do if (f&f_flush) fflush(fp); while (0)
-
- setattr(h, HA_LOC); FLUSH(h->lyt.fp);
- fputs(file, fp); FLUSH(fp);
- setattr(h, HA_LOCSEP); FLUSH(h->lyt.fp);
- fputc(':', fp); FLUSH(fp);
- setattr(h, HA_LOC); FLUSH(h->lyt.fp);
- fprintf(fp, "%u", lno); FLUSH(fp);
- setattr(h, HA_LOCSEP); FLUSH(h->lyt.fp);
- fputc(':', fp); FLUSH(fp);
- setattr(h, HA_PLAIN); FLUSH(h->lyt.fp);
- fputc(' ', fp);
-
-#undef FLUSH
- }
-
-#undef f_flush
-}
-