[llvm] r291786 - Avoid std::errc::protocol_* to appease mingw

Dean Michael Berris via llvm-commits llvm-commits at lists.llvm.org
Thu Jan 12 18:48:56 PST 2017


Yeah, some of these are mirrored from POSIX (
http://en.cppreference.com/w/cpp/error/errc). If there's a better way of
using these 'make_error<...>(...)' APIs without reaching for std::errc:: to
convey some meaning, I'd be happy to change most of the XRay code to do
that instead. An alternative is to create our own error space, or use
something that LLVM already uses.

Any advice on how to make this better so that I don't break things further
going forward?

On Fri, Jan 13, 2017 at 11:31 AM NAKAMURA Takumi <geek4civic at gmail.com>
wrote:

> Dean, tweaked in r291863.
>
> I think std::errc may be OS-oriented errors.
>
> On Fri, Jan 13, 2017 at 8:46 AM Dean Michael Berris <dberris at google.com>
> wrote:
>
> Thanks Hans -- I'll let you decide what to use instead of `bad_message`
> here that's potentially appropriate for some of the errors.
>
> On Fri, Jan 13, 2017 at 5:54 AM Hans Wennborg <hans at chromium.org> wrote:
>
> Now it's failing with xray-account.cc:466:34: error: ‘bad_message’ is
> not a member of ‘std::errc’ instead.
>
> Takumi: I'm planning on creating the 4.0.0 branch soon. Let me know if
> any fixes for this need to be merged.
>
> Thanks,
> Hans
>
> On Thu, Jan 12, 2017 at 10:45 AM, Hans Wennborg <hans at chromium.org> wrote:
> > dberris, takumi: fyi.
> >
> > On Thu, Jan 12, 2017 at 10:33 AM, Hans Wennborg via llvm-commits
> > <llvm-commits at lists.llvm.org> wrote:
> >> Author: hans
> >> Date: Thu Jan 12 12:33:14 2017
> >> New Revision: 291786
> >>
> >> URL: http://llvm.org/viewvc/llvm-project?rev=291786&view=rev
> >> Log:
> >> Avoid std::errc::protocol_* to appease mingw
> >>
> >> Like r291636 and r285261.
> >>
> >> Modified:
> >>     llvm/trunk/lib/XRay/Trace.cpp
> >>     llvm/trunk/tools/llvm-xray/xray-account.cc
> >>     llvm/trunk/tools/llvm-xray/xray-converter.cc
> >>
> >> Modified: llvm/trunk/lib/XRay/Trace.cpp
> >> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/XRay/Trace.cpp?rev=291786&r1=291785&r2=291786&view=diff
> >>
> ==============================================================================
> >> --- llvm/trunk/lib/XRay/Trace.cpp (original)
> >> +++ llvm/trunk/lib/XRay/Trace.cpp Thu Jan 12 12:33:14 2017
> >> @@ -144,7 +144,7 @@ Expected<Trace> llvm::xray::loadTraceFil
> >>    if (FileSize < 4) {
> >>      return make_error<StringError>(
> >>          Twine("File '") + Filename + "' too small for XRay.",
> >> -        std::make_error_code(std::errc::protocol_error));
> >> +        std::make_error_code(std::errc::executable_format_error));
> >>    }
> >>
> >>    // Attempt to mmap the file.
> >>
> >> Modified: llvm/trunk/tools/llvm-xray/xray-account.cc
> >> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-account.cc?rev=291786&r1=291785&r2=291786&view=diff
> >>
> ==============================================================================
> >> --- llvm/trunk/tools/llvm-xray/xray-account.cc (original)
> >> +++ llvm/trunk/tools/llvm-xray/xray-account.cc Thu Jan 12 12:33:14 2017
> >> @@ -477,7 +477,7 @@ static CommandRegistration Unused(&Accou
> >>      return joinErrors(
> >>          make_error<StringError>(
> >>              Twine("Failed loading input file '") + AccountInput + "'",
> >> -            std::make_error_code(std::errc::protocol_error)),
> >> +            std::make_error_code(std::errc::executable_format_error)),
> >>          TraceOrErr.takeError());
> >>    }
> >>
> >>
> >> Modified: llvm/trunk/tools/llvm-xray/xray-converter.cc
> >> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/llvm-xray/xray-converter.cc?rev=291786&r1=291785&r2=291786&view=diff
> >>
> ==============================================================================
> >> --- llvm/trunk/tools/llvm-xray/xray-converter.cc (original)
> >> +++ llvm/trunk/tools/llvm-xray/xray-converter.cc Thu Jan 12 12:33:14
> 2017
> >> @@ -192,7 +192,7 @@ static CommandRegistration Unused(&Conve
> >>      return joinErrors(
> >>          make_error<StringError>(
> >>              Twine("Failed loading input file '") + ConvertInput + "'.",
> >> -            std::make_error_code(std::errc::protocol_error)),
> >> +            std::make_error_code(std::errc::executable_format_error)),
> >>          TraceOrErr.takeError());
> >>    }
> >>    return Error::success();
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170113/02096026/attachment.html>


More information about the llvm-commits mailing list