This is an archive of the discontinued LLVM Phabricator instance.

[llvm-objdump] Delete argv[0] from error messages
AbandonedPublic

Authored by MaskRay on Aug 19 2019, 5:38 AM.

Details

Summary

Currently we report

${argv[0]}: error: ...

GNU objdump does not print error:

${argv[0]}: ...

error: is useful, but repeating argv[0] does not provide lots of value. So switch to:

error: ...

This is also consistent with llvm-objcopy and llvm-readobj.

Diff Detail

Event Timeline

MaskRay created this revision.Aug 19 2019, 5:38 AM

I think it is fine. Lets see what others think.

I don't feel strongly about this, but it would be a departure from what GNU tools and clang and LLD, and even MSVC do, so we probably shouldn't do this. The exact behaviour appears to be somewhat inconsistent, but in most cases, GNU tools do:

<argv[0]>: <error message>

Clang and LLD do:

<tool name>: error: <error message>

I'd therefore suggest that perhaps the correct thing to do is change llvm-objcopy and llvm-readobj.

I guess one advantage with the tool name being printed is that it gives a bit more context in a big long build log, if there are multiple problems, it's possible to tell which error/warning comes from which tool, especially as buffering and multi-threaded builds might result in the error message being rather far from related output.

MSVC appears to do:

<tool name> : <error/warning type> <error code> : <error message>

I don't feel strongly about this, but it would be a departure from what GNU tools and clang and LLD, and even MSVC do, so we probably shouldn't do this. The exact behaviour appears to be somewhat inconsistent, but in most cases, GNU tools do:

<argv[0]>: <error message>

Clang and LLD do:

<tool name>: error: <error message>

I'd therefore suggest that perhaps the correct thing to do is change llvm-objcopy and llvm-readobj.

I guess one advantage with the tool name being printed is that it gives a bit more context in a big long build log, if there are multiple problems, it's possible to tell which error/warning comes from which tool, especially as buffering and multi-threaded builds might result in the error message being rather far from related output.

MSVC appears to do:

<tool name> : <error/warning type> <error code> : <error message>

Created D66425 to prepend argv[0] for llvm-readobj/llvm-readelf. llvm-objcopy already includes argv[0] in its error messages.

rupprecht requested changes to this revision.Aug 19 2019, 10:31 AM

I feel a little more strongly that we need to have the toolname printed as part of the error message.

This revision now requires changes to proceed.Aug 19 2019, 10:31 AM
MaskRay abandoned this revision.Aug 20 2019, 7:09 AM

We've decided to go with D66425.