ValveSoftware / source-sdk-2013

The 2013 edition of the Source SDK
https://developer.valvesoftware.com/wiki/SDK2013_GettingStarted
Other
3.8k stars 2k forks source link

Fix GCC 4.8 warnings (errors if treated as such) #293

Open neico opened 10 years ago

neico commented 10 years ago

Starting with 4.8 the compiler includes -Wunused-local-typedefs by default, this causes public/tier0/dbg.h:558 to cause many errors. To fix it one simply needs to change the line as follows:

Original: #define COMPILE_TIME_ASSERT( pred ) typedef int UNIQUE_ID[ (pred) ? 1 : -1 ]

Fixed: #define COMPILE_TIME_ASSERT( pred ) typedef int UNIQUE_ID[ (pred) ? 1 : -1 ] __attribute__((unused))

This attribute feature is available since 2.95 and therefore should cause no problems in all major versions.

PS: BEGIN_NETWORK_TABLE BEGIN_NETWORK_TABLE_NOBASE BEGIN_SEND_TABLE BEGIN_RECV_TABLE IMPLEMENT_CLIENTCLASS_DT IMPLEMENT_SERVERCLASS_ST macros seem to be affected as well.

There are also a bunch of -Wnarrowing and -Wdelete-non-virtual-dtor warnings and others that need to be taken care of which I don't know if they are actually related to 4.8 as well... What stopped my compiling tough was some errors of my code hidden between this immense spam of warnings, so reducing them is a pretty good idea.