From 4f3ca854e1e25d855c7c2b8f6458edd6aae385c5 Mon Sep 17 00:00:00 2001 From: Brecht Van Lommel Date: Tue, 26 Feb 2013 21:58:06 +0000 Subject: Fix various warnings with clang build, and adjust cmake clang warnings flags to include a few more that gcc is using too. --- source/blender/blenlib/intern/threads.c | 8 +++- source/blender/collada/ArmatureImporter.cpp | 4 +- source/blender/collada/ArmatureImporter.h | 3 +- source/blender/collada/ControllerExporter.cpp | 2 +- source/blender/collada/DocumentImporter.cpp | 2 +- source/blender/collada/TransformReader.cpp | 44 +++++++++++----------- .../compositor/operations/COM_TranslateOperation.h | 2 - source/blender/editors/sculpt_paint/sculpt_undo.c | 2 + source/blender/imbuf/intern/filetype.c | 5 ++- source/blender/makesdna/DNA_image_types.h | 4 +- source/blender/makesrna/intern/CMakeLists.txt | 3 ++ source/blender/modifiers/intern/MOD_meshcache.c | 2 +- source/blender/render/CMakeLists.txt | 3 +- source/blender/render/intern/raytrace/reorganize.h | 3 -- .../BlenderRoutines/BL_KetsjiEmbedStart.cpp | 2 +- .../gameengine/GameLogic/Joystick/SCA_Joystick.cpp | 10 ++--- .../GameLogic/Joystick/SCA_JoystickDefines.h | 4 +- source/gameengine/Ketsji/KX_IpoConvert.h | 2 +- 18 files changed, 56 insertions(+), 49 deletions(-) (limited to 'source') diff --git a/source/blender/blenlib/intern/threads.c b/source/blender/blenlib/intern/threads.c index 686484ef1db..a74f82ae965 100644 --- a/source/blender/blenlib/intern/threads.c +++ b/source/blender/blenlib/intern/threads.c @@ -429,12 +429,16 @@ void BLI_spin_unlock(SpinLock *spin) #endif } +#ifndef __APPLE__ void BLI_spin_end(SpinLock *spin) { -#ifndef __APPLE__ pthread_spin_destroy(spin); -#endif } +#else +void BLI_spin_end(SpinLock *UNUSED(spin)) +{ +} +#endif /* Read/Write Mutex Lock */ diff --git a/source/blender/collada/ArmatureImporter.cpp b/source/blender/collada/ArmatureImporter.cpp index c270a1e6b20..221a5008f10 100644 --- a/source/blender/collada/ArmatureImporter.cpp +++ b/source/blender/collada/ArmatureImporter.cpp @@ -49,8 +49,8 @@ static const char *bc_get_joint_name(T *node) return id.size() ? id.c_str() : node->getOriginalId().c_str(); } -ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce) : - TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh), anim_importer(anim) { +ArmatureImporter::ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce) : + TransformReader(conv), scene(sce), empty(NULL), mesh_importer(mesh) { } ArmatureImporter::~ArmatureImporter() diff --git a/source/blender/collada/ArmatureImporter.h b/source/blender/collada/ArmatureImporter.h index b07edfbf34d..2a8f1a65e21 100644 --- a/source/blender/collada/ArmatureImporter.h +++ b/source/blender/collada/ArmatureImporter.h @@ -96,7 +96,6 @@ private: std::map unskinned_armature_map; MeshImporterBase *mesh_importer; - AnimationImporterBase *anim_importer; // This is used to store data passed in write_controller_data. // Arrays from COLLADAFW::SkinControllerData lose ownership, so do this class members @@ -138,7 +137,7 @@ private: TagsMap uid_tags_map; public: - ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, AnimationImporterBase *anim, Scene *sce); + ArmatureImporter(UnitConverter *conv, MeshImporterBase *mesh, Scene *sce); ~ArmatureImporter(); void add_joint(COLLADAFW::Node *node, bool root, Object *parent, Scene *sce); diff --git a/source/blender/collada/ControllerExporter.cpp b/source/blender/collada/ControllerExporter.cpp index a31a1e728f6..39ed0334ae0 100644 --- a/source/blender/collada/ControllerExporter.cpp +++ b/source/blender/collada/ControllerExporter.cpp @@ -284,7 +284,7 @@ void ControllerExporter::export_skin_controller(Object *ob, Object *ob_arm) } if (oob_counter > 0) { - fprintf(stderr, "Ignored %d Vertex weigths which use index to non existing VGroup.\n", oob_counter, joint_index_by_def_index.size()); + fprintf(stderr, "Ignored %d Vertex weigths which use index to non existing VGroup %ld.\n", oob_counter, joint_index_by_def_index.size()); } } diff --git a/source/blender/collada/DocumentImporter.cpp b/source/blender/collada/DocumentImporter.cpp index 2b906fa9ac2..b52a33b21e3 100644 --- a/source/blender/collada/DocumentImporter.cpp +++ b/source/blender/collada/DocumentImporter.cpp @@ -104,7 +104,7 @@ DocumentImporter::DocumentImporter(bContext *C, const ImportSettings *import_set import_settings(import_settings), mImportStage(General), mContext(C), - armature_importer(&unit_converter, &mesh_importer, &anim_importer, CTX_data_scene(C)), + armature_importer(&unit_converter, &mesh_importer, CTX_data_scene(C)), mesh_importer(&unit_converter, &armature_importer, CTX_data_scene(C)), anim_importer(&unit_converter, &armature_importer, CTX_data_scene(C)) { diff --git a/source/blender/collada/TransformReader.cpp b/source/blender/collada/TransformReader.cpp index 67166d819a6..e0ba77e2554 100644 --- a/source/blender/collada/TransformReader.cpp +++ b/source/blender/collada/TransformReader.cpp @@ -46,30 +46,28 @@ void TransformReader::get_node_mat(float mat[4][4], COLLADAFW::Node *node, std:: COLLADAFW::Transformation *tm = node->getTransformations()[i]; COLLADAFW::Transformation::TransformationType type = tm->getTransformationType(); - if (type == COLLADAFW::Transformation::MATRIX) { - // XXX why does this return and discard all following transformations? - dae_matrix_to_mat4(tm, mat); - return; - } - else { - switch (type) { - case COLLADAFW::Transformation::TRANSLATE: - dae_translate_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::ROTATE: - dae_rotate_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::SCALE: - dae_scale_to_mat4(tm, cur); - break; - case COLLADAFW::Transformation::LOOKAT: - case COLLADAFW::Transformation::SKEW: - fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet.\n"); - break; - } - copy_m4_m4(copy, mat); - mult_m4_m4m4(mat, copy, cur); + switch (type) { + case COLLADAFW::Transformation::MATRIX: + // XXX why does this return and discard all following transformations? + dae_matrix_to_mat4(tm, mat); + return; + case COLLADAFW::Transformation::TRANSLATE: + dae_translate_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::ROTATE: + dae_rotate_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::SCALE: + dae_scale_to_mat4(tm, cur); + break; + case COLLADAFW::Transformation::LOOKAT: + case COLLADAFW::Transformation::SKEW: + fprintf(stderr, "LOOKAT and SKEW transformations are not supported yet.\n"); + break; } + + copy_m4_m4(copy, mat); + mult_m4_m4m4(mat, copy, cur); if (animation_map) { // AnimationList that drives this Transformation diff --git a/source/blender/compositor/operations/COM_TranslateOperation.h b/source/blender/compositor/operations/COM_TranslateOperation.h index d53c3e464fc..a638ae7ce69 100644 --- a/source/blender/compositor/operations/COM_TranslateOperation.h +++ b/source/blender/compositor/operations/COM_TranslateOperation.h @@ -33,8 +33,6 @@ private: float m_deltaX; float m_deltaY; bool m_isDeltaSet; - float m_relativeOffsetX; - float m_relativeOffsetY; float m_factorX; float m_factorY; public: diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index c828e8c8651..406756f4197 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -567,6 +567,8 @@ static SculptUndoNode *sculpt_undo_alloc_node(Object *ob, PBVHNode *node, unode->totvert = totvert; } + else + maxgrid = 0; /* we will use this while sculpting, is mapalloc slow to access then? */ diff --git a/source/blender/imbuf/intern/filetype.c b/source/blender/imbuf/intern/filetype.c index 5c2dc0c7df9..37070c7e2bf 100644 --- a/source/blender/imbuf/intern/filetype.c +++ b/source/blender/imbuf/intern/filetype.c @@ -26,6 +26,9 @@ #include + +#include "BLI_utildefines.h" + #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" #include "IMB_filetype.h" @@ -56,7 +59,7 @@ static int imb_ftype_iris(ImFileType *type, ImBuf *ibuf) return (ibuf->ftype == IMAGIC); } #ifdef WITH_QUICKTIME -static int imb_ftype_quicktime(ImFileType *type, ImBuf *ibuf) +static int imb_ftype_quicktime(ImFileType *UNUSED(type), ImBuf *UNUSED(ibuf)) { return 0; /* XXX */ } diff --git a/source/blender/makesdna/DNA_image_types.h b/source/blender/makesdna/DNA_image_types.h index 682f54481fc..54ec07c1855 100644 --- a/source/blender/makesdna/DNA_image_types.h +++ b/source/blender/makesdna/DNA_image_types.h @@ -101,10 +101,12 @@ typedef struct Image { float lastupdate; int lastused; short animspeed; + short pad2; /* for generated images */ - short gen_x, gen_y; + int gen_x, gen_y; char gen_type, gen_flag; + char gen_pad[2]; /* display aspect - for UV editing images resized for faster openGL display */ float aspx, aspy; diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt index 7b6fb30d692..7621ebb70b3 100644 --- a/source/blender/makesrna/intern/CMakeLists.txt +++ b/source/blender/makesrna/intern/CMakeLists.txt @@ -277,6 +277,9 @@ add_executable(makesrna ${SRC} ${SRC_RNA_INC} ${SRC_DNA_INC}) target_link_libraries(makesrna bf_dna) target_link_libraries(makesrna bf_dna_blenlib) +# too many warnings with clang +remove_cc_flag("-Wmissing-prototypes") + # Output rna_*_gen.c # note (linux only): with crashes try add this after COMMAND: valgrind --leak-check=full --track-origins=yes add_custom_command( diff --git a/source/blender/modifiers/intern/MOD_meshcache.c b/source/blender/modifiers/intern/MOD_meshcache.c index 5e702a4eabc..be7bfae22fb 100644 --- a/source/blender/modifiers/intern/MOD_meshcache.c +++ b/source/blender/modifiers/intern/MOD_meshcache.c @@ -251,7 +251,7 @@ static void meshcache_do( /* -------------------------------------------------------------------- */ /* Apply the transformation matrix (if needed) */ if (UNLIKELY(err_str)) { - modifier_setError(&mcmd->modifier, err_str); + modifier_setError(&mcmd->modifier, "%s", err_str); } else if (ok) { bool use_matrix = false; diff --git a/source/blender/render/CMakeLists.txt b/source/blender/render/CMakeLists.txt index eb81e7f2049..59debbdc41b 100644 --- a/source/blender/render/CMakeLists.txt +++ b/source/blender/render/CMakeLists.txt @@ -159,7 +159,8 @@ if(WITH_GAMEENGINE) endif() if(APPLE) - if(CMAKE_OSX_ARCHITECTURES MATCHES "i386" OR CMAKE_OSX_ARCHITECTURES MATCHES "x86_64") + # SSE math is enabled by default on x86_64 + if(CMAKE_OSX_ARCHITECTURES MATCHES "i386") set(CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE} -mfpmath=sse") set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -mfpmath=sse") endif() diff --git a/source/blender/render/intern/raytrace/reorganize.h b/source/blender/render/intern/raytrace/reorganize.h index 9d9711eee56..5624df25267 100644 --- a/source/blender/render/intern/raytrace/reorganize.h +++ b/source/blender/render/intern/raytrace/reorganize.h @@ -80,7 +80,6 @@ void reorganize_find_fittest_parent(Node *tree, Node *node, std::pair void reorganize(Node *root) { @@ -109,8 +108,6 @@ void reorganize(Node *root) tmp->sibling = best.second->child; best.second->child = tmp; - - tot_moves++; } diff --git a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp index e78b996391e..450ae1a16b5 100644 --- a/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp +++ b/source/gameengine/BlenderRoutines/BL_KetsjiEmbedStart.cpp @@ -183,7 +183,7 @@ static int BL_KetsjiNextFrame(KX_KetsjiEngine *ketsjiengine, bContext *C, wmWind } struct BL_KetsjiNextFrameState { - struct KX_KetsjiEngine* ketsjiengine; + class KX_KetsjiEngine* ketsjiengine; struct bContext *C; struct wmWindow* win; struct Scene* scene; diff --git a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp index dce62ad189a..8e729ffd7ae 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp +++ b/source/gameengine/GameLogic/Joystick/SCA_Joystick.cpp @@ -81,7 +81,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) return NULL; #else /* WITH_SDL */ if (joyindex < 0 || joyindex >= JOYINDEX_MAX) { - ECHO("Error-invalid joystick index: " << joyindex); + JOYSTICK_ECHO("Error-invalid joystick index: " << joyindex); return NULL; } @@ -96,7 +96,7 @@ SCA_Joystick *SCA_Joystick::GetInstance( short int joyindex ) # else if (SDL_InitSubSystem(SDL_INIT_JOYSTICK | SDL_INIT_VIDEO) == -1 ) { # endif - ECHO("Error-Initializing-SDL: " << SDL_GetError()); + JOYSTICK_ECHO("Error-Initializing-SDL: " << SDL_GetError()); return NULL; } @@ -242,7 +242,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) if (m_isinit == false) { if (m_joyindex>=m_joynum) { /* don't print a message, because this is done anyway */ - //ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); + //JOYSTICK_ECHO("Joystick-Error: " << SDL_NumJoysticks() << " avaiable joystick(s)"); /* Need this so python args can return empty lists */ m_axismax = m_buttonmax = m_hatmax = 0; @@ -253,7 +253,7 @@ bool SCA_Joystick::CreateJoystickDevice(void) SDL_JoystickEventState(SDL_ENABLE); m_isinit = true; - ECHO("Joystick " << m_joyindex << " initialized"); + JOYSTICK_ECHO("Joystick " << m_joyindex << " initialized"); /* must run after being initialized */ m_axismax = SDL_JoystickNumAxes(m_private->m_joystick); @@ -279,7 +279,7 @@ void SCA_Joystick::DestroyJoystickDevice(void) #ifdef WITH_SDL if (m_isinit) { if (SDL_JoystickOpened(m_joyindex)) { - ECHO("Closing-joystick " << m_joyindex); + JOYSTICK_ECHO("Closing-joystick " << m_joyindex); SDL_JoystickClose(m_private->m_joystick); } m_isinit = false; diff --git a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h index 148bdd0962e..37c867ef7d6 100644 --- a/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h +++ b/source/gameengine/GameLogic/Joystick/SCA_JoystickDefines.h @@ -37,10 +37,10 @@ #endif #ifndef _DEBUG -# define ECHO(x) +# define JOYSTICK_ECHO(x) #else # include -# define ECHO(x) std::cout << x << std::endl; +# define JOYSTICK_ECHO(x) std::cout << x << std::endl; #endif #define JOYINDEX_MAX 8 diff --git a/source/gameengine/Ketsji/KX_IpoConvert.h b/source/gameengine/Ketsji/KX_IpoConvert.h index 1f4e1bea96d..a653e4e110b 100644 --- a/source/gameengine/Ketsji/KX_IpoConvert.h +++ b/source/gameengine/Ketsji/KX_IpoConvert.h @@ -59,7 +59,7 @@ SG_Controller *BL_CreateCameraIPO(bAction *action, SG_Controller *BL_CreateMaterialIpo( bAction *action, - class Material* blendermaterial, + struct Material* blendermaterial, dword matname_hash, KX_GameObject* gameobj, KX_BlenderSceneConverter *converter); -- cgit v1.2.3