fix some complier warnings and add -Wundef to CMake's default GCC warnings.

This commit is contained in:
Campbell Barton
2011-09-05 23:40:52 +00:00
parent 0c992c73a1
commit 0991bed413
7 changed files with 17 additions and 5 deletions

View File

@@ -1267,6 +1267,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_POINTER_ARITH -Wpointer-arith)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNUSED_PARAMETER -Wunused-parameter)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_WRITE_STRINGS -Wwrite-strings)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_UNDEFINED -Wundef)
# disable because it gives warnings for printf() & friends. # disable because it gives warnings for printf() & friends.
# ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion) # ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_DOUBLE_PROMOTION -Wdouble-promotion -Wno-error=double-promotion)
ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable) ADD_CHECK_C_COMPILER_FLAG(C_WARNINGS C_WARN_NO_ERROR_UNUSED_BUT_SET_VARIABLE -Wno-error=unused-but-set-variable)
@@ -1274,6 +1275,7 @@ if(CMAKE_COMPILER_IS_GNUCC)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_ALL -Wall)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_INVALID_OFFSETOF -Wno-invalid-offsetof)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare) ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_NO_SIGN_COMPARE -Wno-sign-compare)
ADD_CHECK_CXX_COMPILER_FLAG(CXX_WARNINGS CXX_WARN_UNDEFINED -Wundef)
elseif(CMAKE_C_COMPILER_ID MATCHES "Intel") elseif(CMAKE_C_COMPILER_ID MATCHES "Intel")

View File

@@ -31,6 +31,13 @@ remove_strict_flags()
# and debug gives a lot of prints on UV unwrapping. developers can enable if they need to. # and debug gives a lot of prints on UV unwrapping. developers can enable if they need to.
remove_flag("-DDEBUG") remove_flag("-DDEBUG")
# quiet compiler warnings about undefined defines
add_definitions(
-DDEBUGlevel=0
-DPRNTlevel=0
)
set(INC set(INC
extern extern
superlu superlu

View File

@@ -158,7 +158,7 @@ void ntreeInitTypes(bNodeTree *ntree)
ntree->init |= NTREE_TYPE_INIT; ntree->init |= NTREE_TYPE_INIT;
} }
static bNodeSocket *make_socket(bNodeTree *ntree, int in_out, const char *name, int type) static bNodeSocket *make_socket(bNodeTree *UNUSED(ntree), int in_out, const char *name, int type)
{ {
bNodeSocketType *stype= ntreeGetSocketType(type); bNodeSocketType *stype= ntreeGetSocketType(type);
bNodeSocket *sock; bNodeSocket *sock;

View File

@@ -549,7 +549,7 @@ static void node_draw_basis(const bContext *C, ARegion *ar, SpaceNode *snode, bN
bNodeSocket *sock; bNodeSocket *sock;
rctf *rct= &node->totr; rctf *rct= &node->totr;
float iconofs; float iconofs;
float socket_size= NODE_SOCKSIZE*U.dpi/72; /* float socket_size= NODE_SOCKSIZE*U.dpi/72; */ /* UNUSED */
float iconbutw= 0.8f*UI_UNIT_X; float iconbutw= 0.8f*UI_UNIT_X;
int color_id= node_get_colorid(node); int color_id= node_get_colorid(node);
char showname[128]; /* 128 used below */ char showname[128]; /* 128 used below */

View File

@@ -2175,7 +2175,6 @@ static int node_duplicate_exec(bContext *C, wmOperator *op)
bNode *node, *newnode, *lastnode; bNode *node, *newnode, *lastnode;
bNodeLink *link, *newlink, *lastlink; bNodeLink *link, *newlink, *lastlink;
int keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs"); int keep_inputs = RNA_boolean_get(op->ptr, "keep_inputs");
bNodeSocket *sock;
ED_preview_kill_jobs(C); ED_preview_kill_jobs(C);

View File

@@ -243,7 +243,6 @@ void BL_SkinDeformer::BGEDeformVerts()
for (int i=0; i<m_bmesh->totvert; ++i) for (int i=0; i<m_bmesh->totvert; ++i)
{ {
float contrib = 0.f, weight, max_weight=0.f; float contrib = 0.f, weight, max_weight=0.f;
Bone *bone;
bPoseChannel *pchan=NULL; bPoseChannel *pchan=NULL;
MDeformVert *dvert; MDeformVert *dvert;
Eigen::Map<Eigen::Vector3f> norm(m_transnors[i]); Eigen::Map<Eigen::Vector3f> norm(m_transnors[i]);
@@ -266,7 +265,6 @@ void BL_SkinDeformer::BGEDeformVerts()
if (index < numGroups && (pchan=m_dfnrToPC[index])) if (index < numGroups && (pchan=m_dfnrToPC[index]))
{ {
weight = dvert->dw[j].weight; weight = dvert->dw[j].weight;
bone = pchan->bone;
if (weight) if (weight)
{ {

View File

@@ -385,6 +385,12 @@ void KX_BlenderSceneConverter::ConvertScene(class KX_Scene* destinationscene,
//This cache mecanism is buggy so I leave it disable and the memory leak //This cache mecanism is buggy so I leave it disable and the memory leak
//that would result from this is fixed in RemoveScene() //that would result from this is fixed in RemoveScene()
m_map_mesh_to_gamemesh.clear(); m_map_mesh_to_gamemesh.clear();
#ifndef USE_BULLET
/* quiet compiler warning */
(void)useDbvtCulling;
#endif
} }
// This function removes all entities stored in the converter for that scene // This function removes all entities stored in the converter for that scene