GCC Wallification

This commit is contained in:
Scott Ehlert
2006-08-27 02:17:18 +00:00
parent 6786b0e356
commit 81ac41037b
41 changed files with 486 additions and 431 deletions

View File

@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -224,7 +224,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
* Who put these backwards...
*/
#define TRYREAD(t_var, t_num, t_size, t_file) \
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
break; \
}

View File

@ -6,7 +6,7 @@ MM_ROOT = ../../../metamod/metamod
### EDIT BELOW FOR OTHER PROJECTS ###
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer -Wall -fno-strict-aliasing
OPT_FLAGS = -O3 -funroll-loops -s -pipe -fomit-frame-pointer -fno-strict-aliasing
DEBUG_FLAGS = -g -ggdb3
CPP = gcc-4.1
NAME = csx
@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -34,7 +34,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -538,6 +538,9 @@ static cell AMX_NATIVE_CALL objective_set_data(AMX *amx, cell *params){ // index
case CP_model_axis :
strcpy(GET_CP_PD(pent).model_axis,szValue);
return 1;
default:
break;
}
return 1;
@ -638,6 +641,9 @@ static cell AMX_NATIVE_CALL objective_get_data(AMX *amx, cell *params){ // flagi
MF_SetAmxString(amx,params[3],GET_CP_PD(mObjects.obj[index].pEdict).model_axis,len);
}
return 1;
default:
break;
}
return 1;
}
@ -729,6 +735,9 @@ static cell AMX_NATIVE_CALL area_set_data(AMX *amx, cell *params){ // index, key
case CA_sprite:
strcpy(GET_CA_PD( mObjects.obj[index].pAreaEdict ).hud_sprite,szValue);
return 1;
default:
break;
}
return 1;
}

View File

@ -236,7 +236,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
* Who put these backwards...
*/
#define TRYREAD(t_var, t_num, t_size, t_file) \
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
break; \
}

View File

@ -34,7 +34,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -37,7 +37,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -Wno-invalid-offsetof
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti -Wno-invalid-offsetof
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -28,6 +28,7 @@
#ifndef _WIN32
#include <netdb.h>
#include <netinet/in.h> /* For ntohl */
#include <arpa/inet.h>
#else
#include <windows.h>
#endif
@ -649,7 +650,7 @@ char *_get_name (GeoIP* gi, unsigned long ipnum) {
org_buf = malloc(sizeof(char) * (strlen(buf)+1));
strcpy(org_buf, buf);
} else {
buf_pointer = gi->cache + (long)record_pointer;
buf_pointer = (char *)gi->cache + (long)record_pointer;
org_buf = malloc(sizeof(char) * (strlen(buf_pointer)+1));
strcpy(org_buf, buf_pointer);
}

View File

@ -35,7 +35,10 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
# Strip C++ options for compiling *.c files
C_CFLAGS := $(shell echo $(CFLAGS) | sed -e 's/-fvisibility-inlines-hidden//' | sed -e 's/-fno-rtti//')
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)
@ -47,19 +50,23 @@ else
endif
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
$(BIN_DIR)/%.o: %.cpp
$(CPP) $(INCLUDE) $(CFLAGS) -o $@ -c $<
$(BIN_DIR)/%.o: %.c
$(CPP) $(INCLUDE) $(C_CFLAGS) -o $@ -c $<
all:
mkdir -p $(BIN_DIR)
mkdir -p $(BIN_DIR)/sdk
$(MAKE) geoip
amd64:
$(MAKE) all AMD64=true
geoip: $(OBJ_LINUX)
echo ZUMBAWUMBA $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(CFLAGS) $(OBJ_LINUX) $(LINK) -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
debug:
@ -74,4 +81,4 @@ clean:
rm -rf Debug/*.o
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_32)
rm -rf Debug/$(NAME)_$(BIN_SUFFIX_64)

View File

@ -40,7 +40,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -Dstricmp=strcasecmp -fno-rtti -static-libgcc
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -Dstricmp=strcasecmp -fno-rtti -static-libgcc
CFLAGS += -DSM_DEFAULT_THREADER
ifeq "$(AMD64)" "true"

View File

@ -7,6 +7,8 @@ namespace SourceMod
{
class IResultRow
{
public:
virtual ~IResultRow() { };
public:
/**
* This will return NULL if the entry is NULL.
@ -26,6 +28,8 @@ namespace SourceMod
class IResultSet
{
public:
virtual ~IResultSet() { };
public:
//free the handle if necessary (see IQuery).
virtual void FreeHandle() =0;
@ -65,6 +69,8 @@ namespace SourceMod
class IQuery
{
public:
virtual ~IQuery() { };
public:
//you must free the handle when done
virtual void FreeHandle() =0;
@ -94,6 +100,8 @@ namespace SourceMod
class IDatabase
{
public:
virtual ~IDatabase() { };
public:
/**
* Closes the database and frees the handle.
@ -130,6 +138,8 @@ namespace SourceMod
class ISQLDriver
{
public:
virtual ~ISQLDriver() { };
public:
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
virtual const char *NameString() =0;

View File

@ -92,6 +92,8 @@ namespace SourceMod
*/
class IThread
{
public:
virtual ~IThread() { };
public:
//Called when the thread runs
virtual void RunThread(IThreadHandle *pHandle) =0;
@ -107,6 +109,8 @@ namespace SourceMod
*/
class IThreadCreator
{
public:
virtual ~IThreadCreator() { };
public:
//Makes a thread and cleans up the handle for you
virtual void MakeThread(IThread *pThread) =0;
@ -147,6 +151,8 @@ namespace SourceMod
class IEventSignal
{
public:
virtual ~IEventSignal() { };
public:
/**
* Waits for the signal.

View File

@ -34,7 +34,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -20,6 +20,8 @@ public:
class IVaultMngr
{
public:
virtual ~IVaultMngr() { }
public:
/**
* Note: Will return NULL if the vault failed to create.

View File

@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fexceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fexceptions -DHAVE_STDINT_H -fno-rtti -static-libgcc
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -35,7 +35,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
ifeq "$(AMD64)" "true"
BINARY = $(NAME)_$(BIN_SUFFIX_64)

View File

@ -31,25 +31,29 @@ C_OBJECTS = $(SQL)/attach.c $(SQL)/auth.c $(SQL)/btree.c $(SQL)/build.c \
$(SQL)/prepare.c $(SQL)/expr.c $(SQL)/callback.c $(SQL)/alter.c \
$(SQL)/vdbefifo.c $(SQL)/complete.c $(SQL)/analyze.c
CFLAGS = -Wall -Werror
CPPFLAGS = -Wall -Wno-non-virtual-dtor -Werror
LINK = -static-libgcc -lpthread /lib/libgcc_eh.a /lib/libstdc++.a
INCLUDE = -I. -I$(HLSDK) -I$(HLSDK)/dlls -I$(HLSDK)/engine -I$(HLSDK)/game_shared -I$(HLSDK)/game_shared \
-I$(MM_ROOT) -I$(HLSDK)/common -I$(SQL) -I./sqlitepp -I./sdk -I./thread
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS += $(DEBUG_FLAGS)
CPPFLAGS += $(DEBUG_FLAGS)
else
BIN_DIR = Release
CFLAGS += $(OPT_FLAGS)
CPPFLAGS += $(OPT_FLAGS)
endif
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
ifeq "$(GCC_VERSION)" "4"
OPT_FLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif
ifeq "$(DEBUG)" "true"
BIN_DIR = Debug
CFLAGS = $(DEBUG_FLAGS)
CPPFLAGS = $(DEBUG_FLAGS)
else
BIN_DIR = Release
CFLAGS = $(OPT_FLAGS)
CPPFLAGS = $(OPT_FLAGS)
CFLAGS += -fvisibility=hidden
CPPFLAGS += -fvisibility=hidden -fvisibility-inlines-hidden
endif
CPPFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -fno-rtti

View File

@ -5392,9 +5392,9 @@ int sqlite3BtreeDelete(BtCursor *pCur){
*/
BtCursor leafCur;
unsigned char *pNext;
int szNext; /* The compiler warning is wrong: szNext is always
** initialized before use. Adding an extra initialization
** to silence the compiler slows down the code. */
int szNext = 0; /* The compiler warning is wrong: szNext is always
** initialized before use. Adding an extra initialization
** to silence the compiler slows down the code. */
int notUsed;
unsigned char *tempCell = 0;
assert( !pPage->leafData );

View File

@ -230,7 +230,7 @@ static int vxprintf(
char buf[etBUFSIZE]; /* Conversion buffer */
char prefix; /* Prefix character. "+" or "-" or " " or '\0'. */
etByte errorflag = 0; /* True if an error is encountered */
etByte xtype; /* Conversion paradigm */
etByte xtype = 0; /* Conversion paradigm */
char *zExtra; /* Extra memory used for etTCLESCAPE conversions */
static const char spaces[] =
" ";

View File

@ -688,7 +688,7 @@ static void generateSortTail(
int cont = sqlite3VdbeMakeLabel(v);
int addr;
int iTab;
int pseudoTab;
int pseudoTab = 0;
ExprList *pOrderBy = p->pOrderBy;
iTab = pOrderBy->iECursor;

View File

@ -7,6 +7,8 @@ namespace SourceMod
{
class IResultRow
{
public:
virtual ~IResultRow() { };
public:
/**
* This will return NULL if the entry is NULL.
@ -26,6 +28,8 @@ namespace SourceMod
class IResultSet
{
public:
virtual ~IResultSet() { };
public:
//free the handle if necessary (see IQuery).
virtual void FreeHandle() =0;
@ -65,6 +69,8 @@ namespace SourceMod
class IQuery
{
public:
virtual ~IQuery() { };
public:
//you must free the handle when done
virtual void FreeHandle() =0;
@ -94,6 +100,8 @@ namespace SourceMod
class IDatabase
{
public:
virtual ~IDatabase() { };
public:
/**
* Closes the database and frees the handle.
@ -130,6 +138,8 @@ namespace SourceMod
class ISQLDriver
{
public:
virtual ~ISQLDriver() { };
public:
virtual IDatabase *Connect(DatabaseInfo *info, int *errcode, char *error, size_t maxlength) =0;
virtual const char *NameString() =0;

View File

@ -92,6 +92,8 @@ namespace SourceMod
*/
class IThread
{
public:
virtual ~IThread() { };
public:
//Called when the thread runs
virtual void RunThread(IThreadHandle *pHandle) =0;
@ -107,6 +109,8 @@ namespace SourceMod
*/
class IThreadCreator
{
public:
virtual ~IThreadCreator() { };
public:
//Makes a thread and cleans up the handle for you
virtual void MakeThread(IThread *pThread) =0;
@ -147,6 +151,8 @@ namespace SourceMod
class IEventSignal
{
public:
virtual ~IEventSignal() { };
public:
/**
* Waits for the signal.

View File

@ -234,7 +234,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
* Who put these backwards...
*/
#define TRYREAD(t_var, t_num, t_size, t_file) \
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
break; \
}

View File

@ -34,7 +34,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -34,7 +34,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32

View File

@ -233,7 +233,7 @@ void RankSystem::updatePos( RankStats* rr , Stats* s )
* Who put these backwards...
*/
#define TRYREAD(t_var, t_num, t_size, t_file) \
if (fread(t_var, t_size, t_num, t_file) != t_num) { \
if (fread(t_var, t_size, t_num, t_file) != static_cast<size_t>(t_num)) { \
break; \
}

View File

@ -36,7 +36,7 @@ else
CFLAGS = $(OPT_FLAGS)
endif
CFLAGS += -DNDEBUG -fPIC -Wno-deprecated -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
CFLAGS += -DNDEBUG -fPIC -Wall -Wno-non-virtual-dtor -Werror -fno-exceptions -DHAVE_STDINT_H -static-libgcc -fno-rtti
BINARY = $(NAME)_$(BIN_SUFFIX)
CFLAGS += -DPAWN_CELL_SIZE=32 -DJIT -DASM32