Commit e087a276 authored by Kevin Modzelewski's avatar Kevin Modzelewski

GCC doesn't like zero-length format strings

parent 7e767178
......@@ -88,8 +88,7 @@ BoxedList* getSysPath() {
assert(_sys_path);
if (_sys_path->cls != list_cls) {
fprintf(stderr, "RuntimeError: sys.path must be a list of directory name\n");
raiseExcHelper(RuntimeError, "");
raiseExcHelper(RuntimeError, "sys.path must be a list of directory names");
}
assert(_sys_path->cls == list_cls);
......
......@@ -433,8 +433,7 @@ static PyObject* get_line(BoxedFile* f, int n) noexcept {
Box* fileRead(BoxedFile* self, Box* _size) {
assert(self->cls == file_cls);
if (_size->cls != int_cls) {
fprintf(stderr, "TypeError: an integer is required\n");
raiseExcHelper(TypeError, "");
raiseExcHelper(TypeError, "an integer is required");
}
int64_t size = static_cast<BoxedInt*>(_size)->n;
......@@ -943,12 +942,10 @@ Box* fileNew(BoxedClass* cls, Box* s, Box* m, Box** args) {
m = _PyUnicode_AsDefaultEncodedString(m, NULL);
if (s->cls != str_cls) {
fprintf(stderr, "TypeError: coercing to Unicode: need string of buffer, %s found\n", getTypeName(s));
raiseExcHelper(TypeError, "");
raiseExcHelper(TypeError, "coercing to Unicode: need string of buffer, %s found", getTypeName(s));
}
if (m->cls != str_cls) {
fprintf(stderr, "TypeError: coercing to Unicode: need string of buffer, %s found\n", getTypeName(m));
raiseExcHelper(TypeError, "");
raiseExcHelper(TypeError, "coercing to Unicode: need string of buffer, %s found", getTypeName(m));
}
if (!PyInt_Check(buffering))
......@@ -1111,7 +1108,7 @@ Box* fileIterNext(BoxedFile* s) {
Box* rtn = fileReadline1(s);
assert(!rtn || rtn->cls == str_cls);
if (!rtn || ((BoxedString*)rtn)->s().empty())
raiseExcHelper(StopIteration, "");
raiseExcHelper(StopIteration, (const char*)NULL);
return rtn;
}
......
......@@ -103,7 +103,7 @@ Box* seqiterNext(Box* s) {
else
RELEASE_ASSERT(0, "");
if (hasnext == False)
raiseExcHelper(StopIteration, "");
raiseExcHelper(StopIteration, (const char*)NULL);
}
RELEASE_ASSERT(self->next, "");
......
......@@ -121,10 +121,9 @@ extern "C" Box* listPop(BoxedList* self, Box* idx) {
if (n < 0 || n >= self->size) {
if (self->size == 0)
fprintf(stderr, "IndexError: pop from empty list\n");
raiseExcHelper(IndexError, "pop from empty list");
else
fprintf(stderr, "IndexError: pop index out of range\n");
raiseExcHelper(IndexError, "");
raiseExcHelper(IndexError, "pop index out of range");
}
Box* rtn = self->elts->elts[n];
......
......@@ -668,9 +668,8 @@ BoxedLong* _longNew(Box* val, Box* _base) {
Box* r = callattr(val, long_str, callattr_flags, NULL, NULL, NULL, NULL, NULL);
if (!r) {
fprintf(stderr, "TypeError: long() argument must be a string or a number, not '%s'\n",
getTypeName(val));
raiseExcHelper(TypeError, "");
raiseExcHelper(TypeError, "TypeError: long() argument must be a string or a number, not '%s'\n",
getTypeName(val));
}
if (isSubclass(r->cls, int_cls)) {
......
......@@ -256,7 +256,7 @@ extern "C" void assertFail(Box* assertion_type, Box* msg) {
BoxedString* tostr = str(msg);
raiseExcHelper(static_cast<BoxedClass*>(assertion_type), "%s", tostr->data());
} else {
raiseExcHelper(static_cast<BoxedClass*>(assertion_type), "");
raiseExcHelper(static_cast<BoxedClass*>(assertion_type), (const char*)NULL);
}
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment