Comment 5 for bug 1142781

Revision history for this message
Kiscsirke (csirkeee) wrote :

What you actually mean is that it can't be built with Visual Studio. It builds happily with MinGW on Windows :)

Anyway, yes, probably the attribute is the problem. What is surprising is that it worked before, the attribute was introduced in rev 4206 in the year 2009. I'm guessing maybe the recently introduced stricter warnings could make this a problem, if it also included warnings for Visual Studio? __attribute__ is a GCC compiler specific directive, VS directives are in the form __declspec.

Anyway, if it is the attribute that is the problem, probably we should introduce a conditional macro that is different for different compilers. Something like
#ifdef __GNUC__
 #define GCC_HOT __attribute__((hot))
#else
 #define GCC_HOT
#endif
(A quick search didn't turn up anything analogous in VS for me, so I just define it to nothing there.) This should be placed in a header named like "platform.h" maybe, that is included in these files.

And then with these functions you can replace "__attribute__((hot))" with "GCC_HOT" like
void do_draw(RenderTarget &) GCC_HOT;
(I tested this on MinGW-GCC, it worked there at least.)