[llvm] r296583 - (Rewroking r296581) PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Tue Feb 28 21:44:24 PST 2017


Sorry I missed this use case. I took your suggestion from previous revert
and created BinaryStreamError. We can use that here. I made the changes
everywhere else, but forgot about this one
On Tue, Feb 28, 2017 at 9:23 PM NAKAMURA Takumi via llvm-commits <
llvm-commits at lists.llvm.org> wrote:

> Author: chapuni
> Date: Tue Feb 28 23:11:41 2017
> New Revision: 296583
>
> URL: http://llvm.org/viewvc/llvm-project?rev=296583&view=rev
> Log:
> (Rewroking r296581) PDB/BinaryStreamTest.cpp: Appease mingw to avoid
> std::errc::no_buffer_space.
>
> Unfortunately, mingw's libstdc++ doesn't provide winsock2 errors.
> That said, we should avoid raising OS-oriented error code in our code.
>
> For now, I suggest to define custom error from std::error_category.
> See also; https://reviews.llvm.org/D20592
>
> Modified:
>     llvm/trunk/unittests/DebugInfo/PDB/BinaryStreamTest.cpp
>
> Modified: llvm/trunk/unittests/DebugInfo/PDB/BinaryStreamTest.cpp
> URL:
> http://llvm.org/viewvc/llvm-project/llvm/trunk/unittests/DebugInfo/PDB/BinaryStreamTest.cpp?rev=296583&r1=296582&r2=296583&view=diff
>
> ==============================================================================
> --- llvm/trunk/unittests/DebugInfo/PDB/BinaryStreamTest.cpp (original)
> +++ llvm/trunk/unittests/DebugInfo/PDB/BinaryStreamTest.cpp Tue Feb 28
> 23:11:41 2017
> @@ -13,6 +13,7 @@
>  #include "llvm/DebugInfo/MSF/BinaryStreamReader.h"
>  #include "llvm/DebugInfo/MSF/BinaryStreamRef.h"
>  #include "llvm/DebugInfo/MSF/BinaryStreamWriter.h"
> +#include "llvm/Support/Errc.h"
>  #include "gtest/gtest.h"
>
>  #include <unordered_map>
> @@ -56,7 +57,7 @@ public:
>    Error readBytes(uint32_t Offset, uint32_t Size,
>                    ArrayRef<uint8_t> &Buffer) override {
>      if (Offset + Size > Data.size())
> -      return
> errorCodeToError(make_error_code(std::errc::no_buffer_space));
> +      return
> errorCodeToError(make_error_code(llvm::errc::function_not_supported));
>      uint32_t S = startIndex(Offset);
>      auto Ref = Data.drop_front(S);
>      if (Ref.size() >= Size) {
> @@ -75,7 +76,7 @@ public:
>    Error readLongestContiguousChunk(uint32_t Offset,
>                                     ArrayRef<uint8_t> &Buffer) override {
>      if (Offset >= Data.size())
> -      return
> errorCodeToError(make_error_code(std::errc::no_buffer_space));
> +      return
> errorCodeToError(make_error_code(llvm::errc::function_not_supported));
>      uint32_t S = startIndex(Offset);
>      Buffer = Data.drop_front(S);
>      return Error::success();
> @@ -85,7 +86,7 @@ public:
>
>    Error writeBytes(uint32_t Offset, ArrayRef<uint8_t> SrcData) override {
>      if (Offset + SrcData.size() > Data.size())
> -      return
> errorCodeToError(make_error_code(std::errc::no_buffer_space));
> +      return
> errorCodeToError(make_error_code(llvm::errc::function_not_supported));
>      if (SrcData.empty())
>        return Error::success();
>
>
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-commits
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170301/15ea524d/attachment.html>


More information about the llvm-commits mailing list