On Sun, 15 Nov 2015, Dhole wrote:

> The error output in gcc/c-family/c-common.c (get_source_date_epoch) is
> handled by an fprintf() to stderr followed by an exit (EXIT_FAILURE). I
> am not sure this is the right approach for error handling, as I have
> found many usages of the error() function in the code. If implemented
> with error(), the output looks like this:

fprintf to stderr is never appropriate.  All diagnostics should go through 
a diagnostic function that properly causes the message to be translated.

If you want a fatal error (exit immediately after giving the message 
rather than continuing compilation), use the fatal_error function, which 
takes an explicit location.  You can use UNKNOWN_LOCATION to avoid an 
input file being named, like e.g. the code in toplev.c:

        /* Use UNKOWN_LOCATION to prevent gcc from printing the first
           line in the current file. */
        fatal_error (UNKNOWN_LOCATION,
                     "input file %qs is the same as output file",

Joseph S. Myers

Reproducible-builds mailing list

Reply via email to