1
0
forked from 0ad/0ad

debug_assert now displays function name also. this neatly avoids the need for __func__ in every debug_warn, which also breaks on Linux. all such constructions have been removed.

This was SVN commit r2968.
This commit is contained in:
janwas 2005-10-19 06:29:55 +00:00
parent 02341916dc
commit a953a8ef57
28 changed files with 120 additions and 117 deletions

View File

@ -135,7 +135,7 @@ int da_free(DynArray* da)
if(da->prot & DA_NOT_OUR_MEM)
{
debug_warn(__func__": da is marked DA_NOT_OUR_MEM, must not be altered");
debug_warn("da is marked DA_NOT_OUR_MEM, must not be altered");
return -1;
}
@ -156,7 +156,7 @@ int da_set_size(DynArray* da, size_t new_size)
if(da->prot & DA_NOT_OUR_MEM)
{
debug_warn(__func__": da is marked DA_NOT_OUR_MEM, must not be altered");
debug_warn("da is marked DA_NOT_OUR_MEM, must not be altered");
return -1;
}
@ -191,7 +191,7 @@ int da_set_prot(DynArray* da, int prot)
// mmap-ed, which it probably wasn't here.
if(da->prot & DA_NOT_OUR_MEM)
{
debug_warn(__func__": da is marked DA_NOT_OUR_MEM, must not be altered");
debug_warn("da is marked DA_NOT_OUR_MEM, must not be altered");
return -1;
}
@ -336,7 +336,7 @@ void pool_free(Pool* p, void* el)
if(pool_contains(p, el))
freelist_push(&p->freelist, el);
else
debug_warn(__func__": invalid pointer (not in pool)");
debug_warn("invalid pointer (not in pool)");
}

View File

@ -147,7 +147,7 @@ static AppHooks ah =
void set_app_hooks(AppHooks* ah_)
{
debug_assert(ah_);
ONCE_NOT(debug_warn(__func__": app hooks already set"));
ONCE_NOT(debug_warn("app hooks already set"));
// override members in <ah> if they are non-zero in <ah_>
// (otherwise, we stick with the defaults set above)

View File

@ -59,7 +59,7 @@ void debug_wprintf_mem(const wchar_t* fmt, ...)
va_end(args);
if(len < 0)
{
debug_warn(__func__": vswprintf failed");
debug_warn("vswprintf failed");
return;
}
debug_log_pos += len+2;
@ -386,7 +386,8 @@ ErrorReaction display_error(const wchar_t* description, int flags,
// notify the user that an assertion failed; displays a stack trace with
// local variables.
ErrorReaction debug_assert_failed(const char* file, int line, const char* expr)
ErrorReaction debug_assert_failed(const char* file, int line,
const char* func, const char* expr)
{
// for edge cases in some functions, warnings (=asserts) are raised in
// addition to returning an error code. self-tests deliberately trigger
@ -404,10 +405,11 @@ ErrorReaction debug_assert_failed(const char* file, int line, const char* expr)
uint skip = 1; void* context = 0;
wchar_t buf[200];
swprintf(buf, ARRAY_SIZE(buf), L"Assertion failed in %hs, line %d: \"%hs\"", base_name, line, expr);
swprintf(buf, ARRAY_SIZE(buf), L"Assertion failed in %hs, %hs(%d): \"%hs\"", func, base_name, line, expr);
return display_error(buf, DE_ALLOW_SUPPRESS|DE_MANUAL_BREAK, skip, context, base_name, line);
}
//-----------------------------------------------------------------------------
// thread naming
//-----------------------------------------------------------------------------

View File

@ -114,7 +114,7 @@ STMT(\
static unsigned char suppress__ = 0x55;\
if(suppress__ == 0x55 && !(expr)) \
{ \
switch(debug_assert_failed(__FILE__, __LINE__, #expr))\
switch(debug_assert_failed(__FILE__, __LINE__, __func__, #expr))\
{\
case ER_SUPPRESS:\
suppress__ = 0xAA;\
@ -137,7 +137,8 @@ STMT(\
// headers) and thereby stomped on our definition.
// called when an assertion has failed; notifies the user via display_error.
extern enum ErrorReaction debug_assert_failed(const char* source_file, int line, const char* assert_expr);
extern enum ErrorReaction debug_assert_failed(const char* file, int line,
const char* func, const char* assert_expr);
//-----------------------------------------------------------------------------

View File

@ -40,7 +40,7 @@ int in_add_handler(EventHandler handler)
if(handler_stack_top >= MAX_HANDLERS)
{
debug_warn(__func__": increase MAX_HANDLERS");
debug_warn("increase MAX_HANDLERS");
return -1;
}
@ -63,7 +63,7 @@ void dispatch_event(const SDL_Event* event)
continue;
// .. invalid return value
else
debug_warn(__func__": invalid handler return value");
debug_warn("invalid handler return value");
}
}

View File

@ -174,7 +174,7 @@ bool oglHaveVersion(const char* desired_version)
int desired_major, desired_minor;
if(sscanf(desired_version, "%d.%d", &desired_major, &desired_minor) != 2)
{
debug_warn(__func__": invalid version string");
debug_warn("invalid version string");
return false;
}
@ -182,7 +182,7 @@ bool oglHaveVersion(const char* desired_version)
const char* version = (const char*)glGetString(GL_VERSION);
if(!version || sscanf(version, "%d.%d", &major, &minor) != 2)
{
debug_warn(__func__": GL_VERSION invalid");
debug_warn("GL_VERSION invalid");
return false;
}
@ -288,7 +288,7 @@ void oglCheck()
}
if(error_enountered)
debug_warn(__func__": OpenGL error(s) occurred");
debug_warn("OpenGL error(s) occurred");
}
#endif
@ -319,7 +319,7 @@ void oglSquelchError(GLenum err_to_ignore)
}
if(error_enountered)
debug_warn(__func__": OpenGL error(s) occurred");
debug_warn("OpenGL error(s) occurred");
}
@ -360,7 +360,7 @@ void oglInit()
// time-critical) than centralizing the 'OpenGL is ready' check.
exts = (const char*)glGetString(GL_EXTENSIONS);
if(!exts)
debug_warn(__func__": called before OpenGL is ready for use");
debug_warn("called before OpenGL is ready for use");
have_12 = oglHaveVersion("1.2");
have_13 = oglHaveVersion("1.3");
have_14 = oglHaveVersion("1.4");

View File

@ -288,10 +288,10 @@ int file_set_root_dir(const char* argv0, const char* rel_path)
}
fail:
debug_warn(__func__" failed");
debug_warn("failed");
if(msg)
{
debug_printf(__func__": %s\n", msg);
debug_printf("%s: %s\n", __func__, msg);
return -1;
}
@ -781,7 +781,7 @@ int file_io_issue(File* f, off_t ofs, size_t size, void* p, FileIo* io)
const off_t bytes_left = f->size - ofs;
if(bytes_left < 0)
{
debug_warn(__func__": EOF");
debug_warn("EOF");
return ERR_EOF;
}
if((off_t)size > bytes_left)
@ -832,7 +832,7 @@ int file_io_has_completed(FileIo* io)
if(ret == 0)
return 1;
debug_warn(__func__": unexpected aio_error return");
debug_warn("unexpected aio_error return");
return -1;
}
@ -840,7 +840,7 @@ int file_io_has_completed(FileIo* io)
int file_io_wait(FileIo* io, void*& p, size_t& size)
{
#if CONFIG_PARANOIA
debug_printf(__func__": hio=%p\n", io);
debug_printf("%s: hio=%p\n", __func__, io);
#endif
// zero output params in case something (e.g. H_DEREF) fails.
@ -857,8 +857,8 @@ debug_printf(__func__": hio=%p\n", io);
// query number of bytes transferred (-1 if the transfer failed)
const ssize_t bytes_transferred = aio_return(cb);
#if CONFIG_PARANOIA
debug_printf(__func__": bytes_transferred=%d aio_nbytes=%d\n",
bytes_transferred, cb->aio_nbytes);
debug_printf("%s: bytes_transferred=%d aio_nbytes=%d\n",
__func__, bytes_transferred, cb->aio_nbytes);
#endif
// (size was clipped to EOF in file_io => this is an actual IO error)
if(bytes_transferred < (ssize_t)cb->aio_nbytes)
@ -1004,7 +1004,7 @@ static void* block_find(u64 block_id)
static void block_add(u64 block_id, void* block)
{
if(block_find(block_id))
debug_warn(__func__": already in cache");
debug_warn("already in cache");
else
block_cache[block_id] = block;
}
@ -1115,7 +1115,7 @@ debug_printf("file_io fd=%d size=%d ofs=%d\n", f->fd, data_size, data_ofs);
// (not reading OR using lowio OR no callback)
if(temp && (is_write || no_aio || !cb))
{
debug_warn(__func__": invalid parameter");
debug_warn("invalid parameter");
return ERR_INVALID_PARAM;
}
@ -1334,7 +1334,7 @@ int file_map(File* f, void*& p, size_t& size)
// prevent overflow; if we have this many refs, should find out why.
if(f->map_refs >= MAX_MAP_REFS)
{
debug_warn(__func__": too many references to mapping");
debug_warn("too many references to mapping");
return -1;
}
f->map_refs++;
@ -1374,7 +1374,7 @@ int file_unmap(File* f)
// file is not currently mapped
if(f->map_refs == 0)
{
debug_warn(__func__": not currently mapped");
debug_warn("not currently mapped");
return -1;
}

View File

@ -196,7 +196,7 @@ int vfs_dir_next_ent(const Handle hd, DirEnt* ent, const char* filter)
vd->filter_latched = 1;
}
if(vd->filter != filter)
debug_warn(__func__": filter has changed for this directory. are you scanning it twice?");
debug_warn("filter has changed for this directory. are you scanning it twice?");
#endif
bool want_dir = true;
@ -269,7 +269,7 @@ static void file_listing_add(const char* v_fn)
// we've already shut down - complain.
if(file_listing_enabled == -1)
{
debug_warn(__func__": called after file_listing_shutdown atexit");
debug_warn("called after file_listing_shutdown atexit");
return;
}
@ -296,7 +296,7 @@ void vfs_enable_file_listing(bool want_enabled)
// already shut down - don't allow enabling
if(file_listing_enabled == -1 && want_enabled)
{
debug_warn(__func__": enabling after shutdown");
debug_warn("enabling after shutdown");
return;
}
@ -567,7 +567,7 @@ debug_printf("vfs_load v_fn=%s\n", v_fn);
goto ret;
}
else
debug_warn(__func__": invalid MEM attached to vfile (0 pointer)");
debug_warn("invalid MEM attached to vfile (0 pointer)");
// happens if someone frees the pointer. not an error!
}
/*

View File

@ -543,7 +543,7 @@ static int remount(const Mount& m)
case MT_FILE:
return mount_dir_tree(td, m);
default:
debug_warn(__func__": invalid type");
debug_warn("invalid type");
return ERR_CORRUPTED;
}
}
@ -578,7 +578,7 @@ int vfs_mount(const char* V_mount_point, const char* P_real_path, int flags, uin
#ifndef NDEBUG
const size_t len = strlen(V_mount_point);
if(len && V_mount_point[len-1] != '/')
debug_warn(__func__": path doesn't end in '/'");
debug_warn("path doesn't end in '/'");
#endif
// make sure it's not already mounted, i.e. in mounts.
@ -591,7 +591,7 @@ int vfs_mount(const char* V_mount_point, const char* P_real_path, int flags, uin
{
if(file_is_subpath(P_real_path, it->P_name.c_str()))
{
debug_warn(__func__": already mounted");
debug_warn("already mounted");
return -1;
}
}
@ -601,7 +601,7 @@ int vfs_mount(const char* V_mount_point, const char* P_real_path, int flags, uin
// "./" and "/." are caught by CHECK_PATH.
if(!strcmp(P_real_path, "."))
{
debug_warn(__func__": mounting . not allowed");
debug_warn("mounting . not allowed");
return -1;
}
@ -874,7 +874,7 @@ int x_realpath(const Mount* m, const char* V_exact_path, char* P_real_path)
P_parent_path = m->P_name.c_str();
break;
default:
debug_warn(__func__": invalid type");
debug_warn("invalid type");
return -1;
}
@ -895,7 +895,7 @@ int x_open(const Mount* m, const char* V_exact_path, int flags, TFile* tf, XFile
case MT_ARCHIVE:
if(flags & FILE_WRITE)
{
debug_warn(__func__": requesting write access to file in archive");
debug_warn("requesting write access to file in archive");
return -1;
}
RETURN_ERR(zip_open(m->archive, V_exact_path, flags, &xf->u.zf));
@ -905,7 +905,7 @@ int x_open(const Mount* m, const char* V_exact_path, int flags, TFile* tf, XFile
RETURN_ERR(file_open(P_path, flags, &xf->u.f));
break;
default:
debug_warn(__func__": invalid type");
debug_warn("invalid type");
return ERR_CORRUPTED;
}
@ -933,7 +933,7 @@ int x_close(XFile* xf)
(void)file_close(&xf->u.f);
break;
default:
debug_warn(__func__": invalid type");
debug_warn("invalid type");
break;
}
@ -1022,7 +1022,7 @@ int x_io(XFile* xf, off_t ofs, size_t size, void* buf, FileIOCB cb, uintptr_t ct
return file_io(&xf->u.f, ofs, size, buf, cb, ctx);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}
@ -1037,7 +1037,7 @@ int x_map(XFile* xf, void*& p, size_t& size)
case MT_FILE:
return file_map(&xf->u.f, p, size);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}
@ -1052,7 +1052,7 @@ int x_unmap(XFile* xf)
case MT_FILE:
return file_unmap(&xf->u.f);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}
@ -1068,7 +1068,7 @@ int x_io_issue(XFile* xf, off_t ofs, size_t size, void* buf, XIo* xio)
case MT_FILE:
return file_io_issue(&xf->u.f, ofs, size, buf, &xio->u.fio);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}
@ -1083,7 +1083,7 @@ int x_io_has_completed(XIo* xio)
case MT_FILE:
return file_io_has_completed(&xio->u.fio);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}
@ -1098,7 +1098,7 @@ int x_io_wait(XIo* xio, void*& p, size_t& size)
case MT_FILE:
return file_io_wait(&xio->u.fio, p, size);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}
@ -1113,7 +1113,7 @@ int x_io_discard(XIo* xio)
case MT_FILE:
return file_io_discard(&xio->u.fio);
default:
debug_warn(__func__": invalid file type");
debug_warn("invalid file type");
return ERR_CORRUPTED;
}
}

View File

@ -81,8 +81,8 @@ int path_validate(const uint line, const char* path)
// failed somewhere - err is the error code,
// or -1 if not set specifically above.
fail:
debug_printf(__func__" at line %d failed: %s (error code %d)\n", line, msg, err);
debug_warn(__func__" failed");
debug_printf("%s called from line %d failed: %s (error code %d)\n", __func__, line, msg, err);
debug_warn("failed");
return err;
ok:

View File

@ -106,7 +106,7 @@ TNode* node_alloc(size_t size)
// would overflow a bucket
if(size > BUCKET_SIZE-sizeof(u8*))
{
debug_warn(__func__": size doesn't fit in a bucket");
debug_warn("size doesn't fit in a bucket");
return 0;
}
@ -458,7 +458,7 @@ int TDir::add(const char* name, TNodeType new_type, TNode** pnode)
if(!children.add(name, node))
{
debug_warn(__func__": failed to expand table");
debug_warn("failed to expand table");
// node will be freed by node_free_all
return 0;
}
@ -816,7 +816,7 @@ int tree_dir_next_ent(TreeDirIterator* d_, DirEnt* ent)
ent->mtime = node->u.file.mtime;
break;
default:
debug_warn(__func__": invalid TNode type");
debug_warn("invalid TNode type");
}
return 0; // success

View File

@ -139,7 +139,7 @@ static const u8* z_find_id(const u8* file, size_t size, const u8* start, const c
{
#ifndef NDEBUG
if(p != start)
debug_warn(__func__": archive damaged, but still found next record.");
debug_warn("archive damaged, but still found next record.");
#endif
return p;
}
@ -150,7 +150,7 @@ static const u8* z_find_id(const u8* file, size_t size, const u8* start, const c
}
// passed EOF, didn't find it.
debug_warn(__func__": archive corrupted, next record not found.");
debug_warn("archive corrupted, next record not found.");
return 0;
}
@ -203,7 +203,7 @@ static time_t convert_dos_date(u16 fatdate, u16 fattime)
time_t ret = mktime(&t);
if(ret == (time_t)-1)
debug_warn(__func__": mktime failed");
debug_warn("mktime failed");
return ret;
}
@ -764,7 +764,7 @@ int inf_set_dest(uintptr_t _ctx, void* out, size_t out_size)
if(zs->next_out || zs->avail_out)
{
debug_warn(__func__": ctx already in use!");
debug_warn("ctx already in use!");
return -1;
}
zs->next_out = (Byte*)out;
@ -804,7 +804,7 @@ double t0 = get_time();
if(in)
{
if(ctx->in_buf)
debug_warn(__func__": previous input buffer not empty");
debug_warn("previous input buffer not empty");
zs->avail_in = (uInt)in_size;
zs->next_in = (Byte*)in;
@ -1231,7 +1231,7 @@ int zip_map(ZFile* zf, void*& p, size_t& size)
// compression algorithm is unspecified - disallow it.
if(zfile_compressed(zf))
{
debug_warn(__func__": file is compressed");
debug_warn("file is compressed");
return -1;
}

View File

@ -118,7 +118,7 @@ static GLint choose_fmt(uint bpp, uint flags)
case 5:
return GL_COMPRESSED_RGBA_S3TC_DXT5_EXT;
default:
debug_warn(__func__": invalid DXT value");
debug_warn("invalid DXT value");
return 0;
}
}
@ -138,7 +138,7 @@ static GLint choose_fmt(uint bpp, uint flags)
debug_assert(alpha);
return bgr? GL_BGRA : GL_RGBA;
default:
debug_warn(__func__": invalid bpp");
debug_warn("invalid bpp");
return 0;
}
@ -227,7 +227,7 @@ static GLint choose_int_fmt(GLenum fmt, uint q_flags)
return half_bpp? GL_RGBA4 : GL_RGBA8;
default:
debug_warn(__func__": given fmt isn't covered! please add it.");
debug_warn("given fmt isn't covered! please add it.");
// fall back to a reasonable default
return half_bpp? GL_RGB4 : GL_RGB8;
}
@ -615,7 +615,7 @@ void ogl_tex_override(OglTexOverrides what, OglTexAllow allow)
have_auto_mipmap_gen = enable;
break;
default:
debug_warn(__func__": invalid <what>");
debug_warn("invalid <what>");
break;
}
}
@ -862,7 +862,7 @@ int ogl_tex_get_format(Handle ht, uint* flags, GLenum* fmt)
if(fmt)
{
if(!ot->is_currently_uploaded)
debug_warn(__func__": hasn't been defined yet!");
debug_warn("hasn't been defined yet!");
*fmt = ot->fmt;
}
return 0;

View File

@ -439,7 +439,7 @@ int tex_load(const char* fn, Tex* t)
if(ret < 0)
{
(void)tex_free(t);
debug_warn(__func__" failed");
debug_warn("failed");
}
// do not free hm! it either still holds the image data (i.e. texture
@ -624,8 +624,8 @@ int tex_write(Tex* t, const char* fn)
err = c->encode(t, &da);
if(err < 0)
{
debug_printf(__func__" (%s): %d", c->name, err);
debug_warn(__func__"failed");
debug_printf("%s (%s) failed: %d", __func__, c->name, err);
debug_warn("failed");
goto fail;
}

View File

@ -76,7 +76,7 @@ int tex_codec_transform(Tex* t, uint transforms)
else if(err != TEX_CODEC_CANNOT_HANDLE)
{
ret = err;
debug_warn(__func__": codec indicates error");
debug_warn("codec indicates error");
}
}

View File

@ -286,7 +286,7 @@ static int alloc_idx(i32& idx, HDATA*& hd)
// add another
if(last_in_use >= hdata_cap)
{
debug_warn(__func__": too many open handles (increase IDX_BITS)");
debug_warn("too many open handles (increase IDX_BITS)");
return ERR_LIMIT;
}
idx = last_in_use+1; // just incrementing idx would start it at 1
@ -296,7 +296,7 @@ static int alloc_idx(i32& idx, HDATA*& hd)
// can't fail for any other reason - idx is checked above.
{ // VC6 goto fix
bool is_unused = !hd->tag;
debug_assert(is_unused && __func__": invalid last_in_use");
debug_assert(is_unused && "invalid last_in_use");
}
have_idx:;
@ -491,17 +491,17 @@ static int type_validate(H_Type type)
if(!type)
{
debug_warn(__func__": type is 0");
debug_warn("type is 0");
goto fail;
}
if(type->user_size > HDATA_USER_SIZE)
{
debug_warn(__func__": type's user data is too large for HDATA");
debug_warn("type's user data is too large for HDATA");
goto fail;
}
if(type->name == 0)
{
debug_warn(__func__": type's name field is 0");
debug_warn("type's name field is 0");
goto fail;
}
@ -539,7 +539,7 @@ static Handle reuse_existing_handle(uintptr_t key, H_Type type, uint flags)
HDATA* hd = h_data_tag_type(h, type);
if(hd->refs == REF_MAX)
{
debug_warn(__func__": too many references to a handle - increase REF_BITS");
debug_warn("too many references to a handle - increase REF_BITS");
return ERR_LIMIT;
}
@ -761,7 +761,7 @@ void* h_user_data(const Handle h, const H_Type type)
if(!hd->refs)
{
// note: resetting the tag is not enough (user might pass in its value)
debug_warn(__func__": no references to resource (it's cached, but someone is accessing it directly)");
debug_warn("no references to resource (it's cached, but someone is accessing it directly)");
return 0;
}
@ -777,7 +777,7 @@ const char* h_filename(const Handle h)
HDATA* hd = h_data_tag(h);
if(!hd)
{
debug_warn(__func__" failed");
debug_warn("failed");
return 0;
}
return hd->fn;
@ -789,7 +789,7 @@ int h_reload(const char* fn)
{
if(!fn)
{
debug_warn(__func__": fn = 0");
debug_warn("fn = 0");
// must not continue - some resources not backed by files have
// key = 0 and reloading those would be disastrous.
return ERR_INVALID_PARAM;
@ -873,13 +873,13 @@ void h_add_ref(Handle h)
HDATA* hd = h_data_tag(h);
if(!hd)
{
debug_warn(__func__": invalid handle");
debug_warn("invalid handle");
return;
}
// if there are no refs, how did the caller manage to keep a Handle?!
if(!hd->refs)
debug_warn(__func__": no refs open - resource is cached");
debug_warn("no refs open - resource is cached");
hd->refs++;
}
@ -896,13 +896,13 @@ int h_get_refcnt(Handle h)
HDATA* hd = h_data_tag(h);
if(!hd)
{
debug_warn(__func__": invalid handle");
debug_warn("invalid handle");
return ERR_INVALID_PARAM;
}
// if there are no refs, how did the caller manage to keep a Handle?!
if(!hd->refs)
debug_warn(__func__": no refs open - resource is cached");
debug_warn("no refs open - resource is cached");
return hd->refs;
}
@ -918,7 +918,7 @@ void h_mgr_shutdown()
// each HDATA entry has already been allocated.
if(!hd)
{
debug_warn(__func__": h_data_from_idx failed - why?!");
debug_warn("h_data_from_idx failed - why?!");
continue;
}

View File

@ -106,7 +106,7 @@ static void remove_alloc(void* raw_p)
{
size_t num_removed = ptr_to_h.erase(raw_p);
if(num_removed != 1)
debug_warn(__func__": not in map");
debug_warn("not in map");
}
@ -118,7 +118,7 @@ static void set_alloc(void* raw_p, Handle hm)
It it = ptr_to_h.find(raw_p);
if(it != ptr_to_h.end())
{
debug_warn(__func__": already in map");
debug_warn("already in map");
return;
}
#endif
@ -360,7 +360,7 @@ void* mem_alloc(size_t size, const size_t align, uint flags, Handle* phm)
Handle hm = mem_wrap(p, size, flags, raw_p, raw_size, dtor, ctx);
if(!hm) // failed to allocate a handle
{
debug_warn(__func__": mem_wrap failed");
debug_warn("mem_wrap failed");
dtor(p, size, ctx);
return 0;
}

View File

@ -291,7 +291,7 @@ int snd_set_master_gain(float gain)
{
if(gain < 0)
{
debug_warn(__func__": gain < 0");
debug_warn("gain < 0");
return ERR_INVALID_PARAM;
}
@ -373,7 +373,7 @@ static void al_buf_free(ALuint al_buf)
static void al_buf_shutdown()
{
if(al_bufs_outstanding != 0)
debug_warn(__func__": not all buffers freed!");
debug_warn("not all buffers freed!");
}
@ -655,9 +655,9 @@ static void* io_buf_alloc()
if(!buf)
{
if(!io_bufs)
debug_warn(__func__": not enough memory to allocate buffer pool");
debug_warn("not enough memory to allocate buffer pool");
else
debug_warn(__func__": max #streams exceeded");
debug_warn("max #streams exceeded");
// can't happen (tm) because stream_open enforces MAX_STREAMS.
return 0;
}
@ -766,7 +766,7 @@ static int stream_open(Stream* s, const char* fn)
{
if(active_streams >= MAX_STREAMS)
{
debug_warn(__func__": MAX_STREAMS exceeded - why?");
debug_warn("MAX_STREAMS exceeded - why?");
return -1;
// fail, because we wouldn't have enough IO buffers for all
}
@ -1418,7 +1418,7 @@ static void list_remove(VSrc* vs)
return;
}
debug_warn(__func__": VSrc not found");
debug_warn("VSrc not found");
}
@ -1832,7 +1832,7 @@ int snd_disable(bool disabled)
if(snd_disabled)
{
if(al_initialized)
debug_warn(__func__": already initialized => disable is pointless");
debug_warn("already initialized => disable is pointless");
return 0;
}
else

View File

@ -67,7 +67,7 @@ extern void* alloca(size_t size);
# define __func__ __FUNCTION__
// .. unsupported; remove it from code
#else
# define __func__
# define __func__ "(unknown)"
#endif

View File

@ -181,7 +181,7 @@ static int aio_h_set(const int fd, const HANDLE h)
fail:
unlock();
debug_warn(__func__" failed");
debug_warn("failed");
return -1;
}
@ -225,7 +225,7 @@ WIN_RESTORE_LAST_ERROR;
return 0;
fail:
debug_warn(__func__" failed");
debug_warn("failed");
return -1;
}
@ -250,7 +250,7 @@ int aio_close(int fd)
return 0;
fail:
debug_warn(__func__" failed");
debug_warn("failed");
return -1;
}
@ -382,7 +382,7 @@ static int aio_rw(struct aiocb* cb)
// fail if aiocb is already in use (forbidden by SUSv3)
if(req_find(cb))
{
debug_warn(__func__": aiocb is already in use");
debug_warn("aiocb is already in use");
goto fail;
}
@ -398,14 +398,14 @@ static int aio_rw(struct aiocb* cb)
r = req_alloc(cb);
if(!r)
{
debug_warn(__func__": cannot allocate a Req (too many concurrent IOs)");
debug_warn("cannot allocate a Req (too many concurrent IOs)");
goto fail;
}
HANDLE h = aio_h_get(fd);
if(h == INVALID_HANDLE_VALUE)
{
debug_warn(__func__": associated handle is invalid");
debug_warn("associated handle is invalid");
ret = -EINVAL;
goto fail;
}
@ -531,7 +531,7 @@ int aio_error(const struct aiocb* cb)
// must not pass 0 to req_find - we'd look for a free cb!
if(!cb)
{
debug_warn(__func__": invalid cb");
debug_warn("invalid cb");
return -1;
}
@ -557,14 +557,14 @@ ssize_t aio_return(struct aiocb* cb)
// must not pass 0 to req_find - we'd look for a free cb!
if(!cb)
{
debug_warn(__func__": invalid cb");
debug_warn("invalid cb");
return -1;
}
Req* r = req_find(cb);
if(!r)
{
debug_warn(__func__": cb not found (already called aio_return?)");
debug_warn("cb not found (already called aio_return?)");
return -1;
}
@ -574,7 +574,7 @@ ssize_t aio_return(struct aiocb* cb)
DWORD bytes_transferred;
if(!GetOverlappedResult(r->hFile, &r->ovl, &bytes_transferred, wait))
{
debug_warn(__func__": GetOverlappedResult failed");
debug_warn("GetOverlappedResult failed");
return -1;
}

View File

@ -370,7 +370,7 @@ have_reg:
case DBG_BREAK_DATA_WRITE:
rw = 3; break;
default:
debug_warn(__func__": invalid type");
debug_warn("invalid type");
}
// .. length (determine from addr's alignment).
// note: IA-32 requires len=0 for code breakpoints.

View File

@ -562,7 +562,7 @@ static void out(const wchar_t* fmt, ...)
// make sure out_chars_left remains nonnegative
if((size_t)len > out_chars_left)
{
debug_warn(__func__": apparently wrote more than out_chars_left");
debug_warn("apparently wrote more than out_chars_left");
len = (int)out_chars_left;
}
out_chars_left -= len;

View File

@ -203,7 +203,7 @@ static int dll_list_add(const char* name)
// make sure we're allowed to be called.
if(!dll_list_pos)
{
debug_warn(__func__": called before dll_list_init or after failure");
debug_warn("called before dll_list_init or after failure");
return -1;
}
@ -247,7 +247,7 @@ static int dll_list_add(const char* name)
// didn't fit; complain
sprintf(dll_list_pos, "..."); // (room was reserved above)
dll_list_pos = 0; // poison pill, prevent further calls
debug_warn(__func__": not enough room");
debug_warn("not enough room");
return ERR_BUF_SIZE;
}

View File

@ -218,7 +218,7 @@ int dir_add_watch(const char* dir, intptr_t* _reqnum)
// need it before binding dir to IOCP because it is our "key".
if(last_reqnum == INT_MAX)
{
debug_warn(__func__": request numbers are no longer unique");
debug_warn("request numbers are no longer unique");
CloseHandle(hDir);
goto fail;
}
@ -280,7 +280,7 @@ int dir_cancel_watch(const intptr_t reqnum)
Watch* w = find_watch(reqnum);
if(!w)
{
debug_warn(__func__": watches[reqnum] invalid");
debug_warn("watches[reqnum] invalid");
return -1;
}

View File

@ -278,7 +278,7 @@ static int choose_impl()
return 0;
}
debug_warn(__func__": no safe timer found!");
debug_warn("no safe timer found!");
hrt_impl = HRT_NONE;
hrt_nominal_freq = -1.0;
return -1;
@ -320,7 +320,7 @@ static i64 ticks_lk()
case HRT_NUM_IMPLS:
default:
debug_warn(__func__": invalid impl");
debug_warn("invalid impl");
//-fallthrough
case HRT_NONE:
@ -460,7 +460,7 @@ static int hrt_override_impl(HRTOverride ovr, HRTImpl impl)
if((ovr != HRT_DISABLE && ovr != HRT_FORCE && ovr != HRT_DEFAULT) ||
(impl != HRT_TSC && impl != HRT_QPC && impl != HRT_GTC && impl != HRT_NONE))
{
debug_warn(__func__": invalid ovr or impl param");
debug_warn("invalid ovr or impl param");
return -1;
}

View File

@ -39,7 +39,7 @@ int GlobalsInputHandler(const SDL_Event* ev)
{
// don't complain: this happens when the hotkey system
// spoofs keys (it assigns values starting from SDLK_LAST)
//debug_warn(__func__": invalid key");
//debug_warn("invalid key");
}
return EV_PASS;
@ -49,7 +49,7 @@ int GlobalsInputHandler(const SDL_Event* ev)
if(c < ARRAY_SIZE(g_mouse_buttons))
g_mouse_buttons[c] = (ev->type == SDL_MOUSEBUTTONDOWN);
else
debug_warn(__func__": invalid mouse button");
debug_warn("invalid mouse button");
return EV_PASS;
default:

View File

@ -108,7 +108,7 @@ int LDR_Register(LoadFunc func, void* param, const wchar_t* description,
{
if(state != REGISTERING)
{
debug_warn(__func__": not called between LDR_(Begin|End)Register - why?!");
debug_warn("not called between LDR_(Begin|End)Register - why?!");
// warn here instead of relying on the caller to CHECK_ERR because
// there will be lots of call sites spread around.
return -1;
@ -128,7 +128,7 @@ int LDR_EndRegistering()
return -1;
if(load_requests.empty())
debug_warn(__func__": no LoadRequests queued");
debug_warn("no LoadRequests queued");
state = FIRST_LOAD;
estimated_duration_tally = 0.0;
@ -317,7 +317,7 @@ int LDR_NonprogressiveLoad()
switch(ret)
{
case 0:
debug_warn(__func__": No load in progress");
debug_warn("No load in progress");
return 0; // success
case LDR_ALL_FINISHED:
return 0; // success

View File

@ -95,7 +95,7 @@ int VFSUtil::EnumDirEnts(const CStr start_path, int flags, const char* user_filt
Handle hdir = vfs_dir_open(path);
if(hdir <= 0)
{
debug_warn(__func__": vfs_open_dir failed");
debug_warn("vfs_open_dir failed");
continue;
}