Re: [AD] 2 errors encountered in current CVS

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


On 08 Sep 2001, Sven Sandberg <svsa1977@xxxxxxxxxx> wrote:
> Peter Wang wrote:
> >    /* for compilers without inline ability, and causes warnings for
> >     * unused static functions: */
> >    #define clear(bmp)   ((clear_bitmap)(bmp))
> 
> But this will still break code with C++ methods named `clear()'. I
> really don't think we can use a macro under any circumstances. It's not
> nice to get a warning all the time, but IMHO it's even worse to break
> people's code every now and then.

Ok.

> But I like the idea to make it static,
> it seems to solve all problems!
> 
> Also, note that under gcc you can do
> 
>    static __attribute__((unused)) void clear(BITMAP *bmp)
>    {
>       clear_bitmap(bmp);
>    }

That's good.

> to prevent the warning. Under msvc you can use
> 
>    #pragma warning( disable : 4505 )
> 
> This pragma could be optional since people might want the warning for
> other static functions.

Hopefully Javier's comment holds for all versions of MSVC so we
won't even need it.

Attachment: if it works ok, someone please commit it before the WIP.

-- 
WERXILATION (wurks ul AY shun), n.  The property of some screen doors to
start to slam shut only to catch themselves at the last moment and "float"
to a gentle close.  -- Rich Hall, "Sniglets"
Index: alinline.h
===================================================================
RCS file: /cvsroot/alleg/allegro/include/allegro/alinline.h,v
retrieving revision 1.21
diff -u -r1.21 alinline.h
--- alinline.h	2001/09/03 05:37:52	1.21
+++ alinline.h	2001/09/09 01:42:54
@@ -1339,11 +1339,12 @@
 
 #ifndef ALLEGRO_NO_CLEAR_BITMAP_ALIAS
    #if (defined ALLEGRO_GCC)
-      extern inline void clear(BITMAP *bmp) { clear_bitmap(bmp); }
+      static inline __attribute__((unused)) void clear(BITMAP *bmp)
+      { clear_bitmap(bmp); }
    #elif (defined ALLEGRO_MSVC)
-      __forceinline void clear(BITMAP *bmp) { clear_bitmap(bmp); }
+      static inline void clear(BITMAP *bmp) { clear_bitmap(bmp); }
    #else
-      #define clear(bmp) (clear_bitmap(bmp))
+      static void clear(BITMAP *bmp) { clear_bitmap(bmp); }
    #endif
 #endif
 


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