summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJohn Hodge <tpg@ucc.asn.au>2017-12-16 21:23:18 +0800
committerJohn Hodge <tpg@ucc.asn.au>2017-12-16 21:23:18 +0800
commit398ff88581fbb3c33ff851a044faa35f327d5185 (patch)
treee6729d1f3d654fcdc84863e66bef98d2c09b6ae9 /src
parent6cd1878b5eb779b844f8e34c20b6df29aa227529 (diff)
downloadmrust-398ff88581fbb3c33ff851a044faa35f327d5185.tar.gz
proc_macro - Avoid warnings due to unused return values
Diffstat (limited to 'src')
-rw-r--r--src/expand/proc_macro.cpp16
1 files changed, 12 insertions, 4 deletions
diff --git a/src/expand/proc_macro.cpp b/src/expand/proc_macro.cpp
index 065e020f..2474db5b 100644
--- a/src/expand/proc_macro.cpp
+++ b/src/expand/proc_macro.cpp
@@ -784,10 +784,16 @@ ProcMacroInv::ProcMacroInv(const Span& sp, const char* executable, const ::HIR::
#ifdef _WIN32
#else
int stdin_pipes[2];
- pipe(stdin_pipes);
+ if( pipe(stdin_pipes) != 0 )
+ {
+ BUG(sp, "Unable to create stdin pipe pair for proc macro, " << strerror(errno));
+ }
this->child_stdin = stdin_pipes[1]; // Write end
int stdout_pipes[2];
- pipe(stdout_pipes);
+ if( pipe(stdout_pipes) != 0)
+ {
+ BUG(sp, "Unable to create stdin pipe pair for proc macro, " << strerror(errno));
+ }
this->child_stdout = stdout_pipes[0]; // Read end
posix_spawn_file_actions_t file_actions;
@@ -890,7 +896,8 @@ void ProcMacroInv::send_u8(uint8_t v)
{
#ifdef _WIN32
#else
- write(this->child_stdin, &v, 1);
+ if( write(this->child_stdin, &v, 1) != 1 )
+ BUG(m_parent_span, "Error writing to child, " << strerror(errno));
#endif
}
void ProcMacroInv::send_bytes(const void* val, size_t size)
@@ -898,7 +905,8 @@ void ProcMacroInv::send_bytes(const void* val, size_t size)
this->send_v128u( static_cast<uint64_t>(size) );
#ifdef _WIN32
#else
- write(this->child_stdin, val, size);
+ if( write(this->child_stdin, val, size) != static_cast<ssize_t>(size) )
+ BUG(m_parent_span, "Error writing to child, " << strerror(errno));
#endif
}
void ProcMacroInv::send_v128u(uint64_t val)