]> granicus.if.org Git - llvm/commitdiff
PDB/BinaryStreamTest.cpp: Appease mingw to avoid std::errc::no_buffer_space.
authorNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 1 Mar 2017 05:06:31 +0000 (05:06 +0000)
committerNAKAMURA Takumi <geek4civic@gmail.com>
Wed, 1 Mar 2017 05:06:31 +0000 (05:06 +0000)
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

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@296581 91177308-0d34-0410-b5e6-96231b3b80d8

unittests/DebugInfo/PDB/BinaryStreamTest.cpp

index 5c22a4afa92682eeba75be0dcc73ce3bfca0cbbb..6e99069fd67362b04358a248367c0aa205e64a06 100644 (file)
@@ -56,7 +56,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(std::errc::function_not_supported));
     uint32_t S = startIndex(Offset);
     auto Ref = Data.drop_front(S);
     if (Ref.size() >= Size) {
@@ -75,7 +75,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(std::errc::function_not_supported));
     uint32_t S = startIndex(Offset);
     Buffer = Data.drop_front(S);
     return Error::success();
@@ -85,7 +85,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(std::errc::function_not_supported));
     if (SrcData.empty())
       return Error::success();