[Reproducible-builds] [PATCH] Allow embedded timestamps by C/C++ macros to be set externally (2)

Joseph Myers joseph at codesourcery.com
Mon Nov 16 23:26:51 UTC 2015


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",
                     asm_file_name);

-- 
Joseph S. Myers
joseph at codesourcery.com



More information about the Reproducible-builds mailing list