Re: [AD] al_assert

[ Thread Index | Date Index | More lists.liballeg.org/allegro-developers Archives ]


I added a patch to the tracker, it adds a new AL_FUNC_NORETURN macro
(in case there are any other functions we want to mark) I haven't
tested with MSVC. Unfortunately it now complains that al_assert can
return (which it can) - could we clear that up too?
I've pasted it below, too.
Pete

Index: include/allegro5/platform/almsvc.h
===================================================================
--- include/allegro5/platform/almsvc.h  (revision 12074)
+++ include/allegro5/platform/almsvc.h  (working copy)
@@ -63,6 +63,7 @@
 #define AL_FUNC(type, name, args)      _AL_DLL type __cdecl name args
 #define AL_METHOD(type, name, args)    type (__cdecl *name) args
 #define AL_FUNCPTR(type, name, args)   extern _AL_DLL type (__cdecl *name) args
+#define AL_FUNC_NORETURN(name, args)   __declspec(noreturn)
AL_FUNC(void, name, args)

 #ifdef AL_INLINE
    #define END_OF_INLINE(name)         void *_force_instantiate_##name = name;
Index: include/allegro5/debug.h
===================================================================
--- include/allegro5/debug.h    (revision 12074)
+++ include/allegro5/debug.h    (working copy)
@@ -28,7 +28,7 @@
 AL_FUNC(bool, _al_trace_prefix, (char const *channel, int level,
    char const *file, int line, char const *function));

-AL_FUNC(void, al_assert, (AL_CONST char *file, int linenr));
+AL_FUNC_NORETURN(al_assert, (AL_CONST char *file, int linenr));
 AL_PRINTFUNC(void, al_trace, (AL_CONST char *msg, ...), 1, 2);

 AL_FUNC(void, register_assert_handler, (AL_METHOD(int, handler,
(AL_CONST char *msg))));
Index: include/allegro5/internal/alconfig.h
===================================================================
--- include/allegro5/internal/alconfig.h        (revision 12074)
+++ include/allegro5/internal/alconfig.h        (working copy)
@@ -95,7 +95,10 @@
    #endif

    #define AL_PRINTFUNC(type, name, args, a, b)    AL_FUNC(type,
name, args) __attribute__ ((format (printf, a, b)))
-
+   #ifndef AL_FUNC_NORETURN
+      #define AL_FUNC_NORETURN(name, args) AL_FUNC(void, name, args)
__attribute__((noreturn))
+   #endif
+
    #ifndef INLINE
       #define INLINE          __inline__
    #endif
@@ -223,6 +226,10 @@
    #define AL_PRINTFUNC(type, name, args, a, b)    AL_FUNC(type, name, args)
 #endif

+#ifndef AL_FUNC_NORETURN
+   #define AL_FUNC_NORETURN(name, args) AL_FUNC(void, name, args)
+#endif
+
 #ifndef AL_METHOD
    #define AL_METHOD(type, name, args)             type (*name) args
 #endif




Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/