Fix some warnings in Linux build

This commit is contained in:
ridiculousfish 2014-05-31 13:46:28 -07:00
parent 32f5edc9c5
commit ce4081af93
2 changed files with 5 additions and 5 deletions

View file

@ -646,13 +646,11 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
expression *result = parser.parse_expression(0, (unsigned int)args.size()); expression *result = parser.parse_expression(0, (unsigned int)args.size());
/* Handle errors */ /* Handle errors */
bool errored = false;
for (size_t i = 0; i < parser.errors.size(); i++) for (size_t i = 0; i < parser.errors.size(); i++)
{ {
err.append(L"test: "); err.append(L"test: ");
err.append(parser.errors.at(i)); err.append(parser.errors.at(i));
err.push_back(L'\n'); err.push_back(L'\n');
errored = true;
// For now we only show the first error // For now we only show the first error
break; break;
} }
@ -667,14 +665,12 @@ expression *test_parser::parse_args(const wcstring_list_t &args, wcstring &err)
{ {
append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str()); append_format(err, L"test: unexpected argument at index %lu: '%ls'\n", (unsigned long)result->range.end, args.at(result->range.end).c_str());
} }
errored = true;
delete result; delete result;
result = NULL; result = NULL;
} }
} }
return result; return result;
} }

View file

@ -35,7 +35,7 @@
typedef std::string cstring; typedef std::string cstring;
const file_id_t kInvalidFileID = {-1, -1, -1, -1, -1, -1}; const file_id_t kInvalidFileID = {(dev_t)-1LL, (ino_t)-1LL, (uint64_t)-1LL, -1, -1, (uint32_t)-1};
/** /**
Minimum length of the internal covnersion buffers Minimum length of the internal covnersion buffers
@ -319,6 +319,10 @@ static inline void safe_append(char *buffer, const char *s, size_t buffsize)
strncat(buffer, s, buffsize - strlen(buffer) - 1); strncat(buffer, s, buffsize - strlen(buffer) - 1);
} }
// In general, strerror is not async-safe, and therefore we cannot use it directly
// So instead we have to grub through sys_nerr and sys_errlist directly
// On GNU toolchain, this will produce a deprecation warning from the linker (!!),
// which appears impossible to suppress!
const char *safe_strerror(int err) const char *safe_strerror(int err)
{ {
#if defined(__UCLIBC__) #if defined(__UCLIBC__)