[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [48372] trunk/blender: code cleanup: compile with clang and quiet some warnings.
Campbell Barton
ideasman42 at gmail.com
Thu Jun 28 14:32:20 CEST 2012
Revision: 48372
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=48372
Author: campbellbarton
Date: 2012-06-28 12:32:06 +0000 (Thu, 28 Jun 2012)
Log Message:
-----------
code cleanup: compile with clang and quiet some warnings.
Modified Paths:
--------------
trunk/blender/build_files/cmake/macros.cmake
trunk/blender/intern/guardedalloc/cpp/mallocn.cpp
trunk/blender/source/blender/compositor/intern/COM_MemoryProxy.h
trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
trunk/blender/source/blender/compositor/operations/COM_ChannelMatteOperation.h
trunk/blender/source/blender/editors/interface/view2d.c
trunk/blender/source/blender/makesrna/intern/makesrna.c
trunk/blender/source/blender/makesrna/intern/rna_define.c
trunk/blender/source/blender/makesrna/intern/rna_scene.c
trunk/blender/source/blender/makesrna/intern/rna_sensor.c
trunk/blender/source/blender/makesrna/intern/rna_sequencer_api.c
trunk/blender/source/blender/render/intern/raytrace/bvh.h
Modified: trunk/blender/build_files/cmake/macros.cmake
===================================================================
--- trunk/blender/build_files/cmake/macros.cmake 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/build_files/cmake/macros.cmake 2012-06-28 12:32:06 UTC (rev 48372)
@@ -236,8 +236,7 @@
${OPENGL_glu_LIBRARY}
${PNG_LIBRARIES}
${ZLIB_LIBRARIES}
- ${FREETYPE_LIBRARY}
- ${LAPACK_LIBRARIES})
+ ${FREETYPE_LIBRARY})
# since we are using the local libs for python when compiling msvc projects, we need to add _d when compiling debug versions
if(WITH_PYTHON) # AND NOT WITH_PYTHON_MODULE # WIN32 needs
@@ -346,7 +345,9 @@
if(WITH_INPUT_NDOF)
target_link_libraries(${target} ${NDOF_LIBRARIES})
endif()
-
+ if(WITH_MOD_CLOTH_ELTOPO)
+ target_link_libraries(${target} ${LAPACK_LIBRARIES})
+ endif()
if(WIN32 AND NOT UNIX)
target_link_libraries(${target} ${PTHREADS_LIBRARIES})
endif()
@@ -452,6 +453,12 @@
add_cc_flag("${CC_REMOVE_STRICT_FLAGS}")
endif()
+ if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
+ remove_cc_flag("-Wunused-parameter")
+ remove_cc_flag("-Wunused-variable")
+ remove_cc_flag("-Werror")
+ endif()
+
if(MSVC)
# TODO
endif()
Modified: trunk/blender/intern/guardedalloc/cpp/mallocn.cpp
===================================================================
--- trunk/blender/intern/guardedalloc/cpp/mallocn.cpp 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/intern/guardedalloc/cpp/mallocn.cpp 2012-06-28 12:32:06 UTC (rev 48372)
@@ -29,33 +29,33 @@
#include "../MEM_guardedalloc.h"
/* not default but can be used when needing to set a string */
-void *operator new(size_t size, const char *str)
+void *operator new(size_t size, const char *str) throw(std::bad_alloc)
{
return MEM_mallocN(size, str);
}
-void *operator new[](size_t size, const char *str)
+void *operator new[](size_t size, const char *str) throw(std::bad_alloc)
{
return MEM_mallocN(size, str);
}
-void *operator new(size_t size)
+void *operator new(size_t size) throw(std::bad_alloc)
{
return MEM_mallocN(size, "C++/anonymous");
}
-void *operator new[](size_t size)
+void *operator new[](size_t size) throw(std::bad_alloc)
{
return MEM_mallocN(size, "C++/anonymous[]");
}
-void operator delete(void *p)
+void operator delete(void *p) throw()
{
/* delete NULL is valid in c++ */
if (p)
MEM_freeN(p);
}
-void operator delete[](void *p)
+void operator delete[](void *p) throw()
{
/* delete NULL is valid in c++ */
if (p)
Modified: trunk/blender/source/blender/compositor/intern/COM_MemoryProxy.h
===================================================================
--- trunk/blender/source/blender/compositor/intern/COM_MemoryProxy.h 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/compositor/intern/COM_MemoryProxy.h 2012-06-28 12:32:06 UTC (rev 48372)
@@ -50,12 +50,12 @@
/**
* @brief datatype of this MemoryProxy
*/
- DataType m_datatype;
+ /* DataType m_datatype; */ /* UNUSED */
/**
* @brief channel information of this buffer
*/
- ChannelInfo m_channelInfo[COM_NUMBER_OF_CHANNELS];
+ /* ChannelInfo m_channelInfo[COM_NUMBER_OF_CHANNELS]; */ /* UNUSED */
/**
* @brief the allocated memory
Modified: trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/compositor/operations/COM_BlurBaseOperation.cpp 2012-06-28 12:32:06 UTC (rev 48372)
@@ -27,8 +27,9 @@
#include "RE_pipeline.h"
}
-BlurBaseOperation::BlurBaseOperation(DataType data_type=COM_DT_COLOR) : NodeOperation()
+BlurBaseOperation::BlurBaseOperation(DataType data_type) : NodeOperation()
{
+ /* data_type is almost always COM_DT_COLOR except for alpha-blur */
this->addInputSocket(data_type);
this->addInputSocket(COM_DT_VALUE);
this->addOutputSocket(data_type);
Modified: trunk/blender/source/blender/compositor/operations/COM_ChannelMatteOperation.h
===================================================================
--- trunk/blender/source/blender/compositor/operations/COM_ChannelMatteOperation.h 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/compositor/operations/COM_ChannelMatteOperation.h 2012-06-28 12:32:06 UTC (rev 48372)
@@ -32,7 +32,7 @@
private:
SocketReader *m_inputImageProgram;
- int m_color_space; /* node->custom1 */
+ /* int m_color_space; */ /* node->custom1 */ /* UNUSED */ /* TODO ? */
int m_matte_channel; /* node->custom2 */
int m_limit_method; /* node->algorithm */
int m_limit_channel; /* node->channel */
Modified: trunk/blender/source/blender/editors/interface/view2d.c
===================================================================
--- trunk/blender/source/blender/editors/interface/view2d.c 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/editors/interface/view2d.c 2012-06-28 12:32:06 UTC (rev 48372)
@@ -1346,7 +1346,7 @@
glBegin(GL_LINES);
for (; start < v2d->cur.xmax; start += lstep, ++i) {
- if (i == 0 || (level < totlevels-1 && i % level_size == 0))
+ if (i == 0 || (level < totlevels - 1 && i % level_size == 0))
continue;
glVertex2f(start, v2d->cur.ymin);
glVertex2f(start, v2d->cur.ymax);
@@ -1356,14 +1356,14 @@
start = i * lstep;
for (; start < v2d->cur.ymax; start += lstep, ++i) {
- if (i == 0 || (level < totlevels-1 && i % level_size == 0))
+ if (i == 0 || (level < totlevels - 1 && i % level_size == 0))
continue;
glVertex2f(v2d->cur.xmin, start);
glVertex2f(v2d->cur.xmax, start);
}
/* X and Y axis */
- UI_ThemeColorShade(TH_BACK, offset-8);
+ UI_ThemeColorShade(TH_BACK, offset - 8);
glVertex2f(0.0f, v2d->cur.ymin);
glVertex2f(0.0f, v2d->cur.ymax);
glVertex2f(v2d->cur.xmin, 0.0f);
Modified: trunk/blender/source/blender/makesrna/intern/makesrna.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/makesrna.c 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/makesrna/intern/makesrna.c 2012-06-28 12:32:06 UTC (rev 48372)
@@ -51,6 +51,13 @@
# define __func__ __FUNCTION__
#endif
+/* copied from BKE_utildefines.h ugh */
+#ifdef __GNUC__
+# define UNUSED(x) UNUSED_ ## x __attribute__((__unused__))
+#else
+# define UNUSED(x) x
+#endif
+
/* Replace if different */
#define TMP_EXT ".tmp"
@@ -310,7 +317,7 @@
fprintf(f, " %s *data= (%s*)(ptr->data);\n", dp->dnastructname, dp->dnastructname);
}
-static void rna_print_id_get(FILE *f, PropertyDefRNA *dp)
+static void rna_print_id_get(FILE *f, PropertyDefRNA *UNUSED(dp))
{
fprintf(f, " ID *id= ptr->id.data;\n");
}
@@ -1179,7 +1186,7 @@
return func;
}
-static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+static char *rna_def_property_next_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
{
char *func, *getfunc;
@@ -1206,7 +1213,7 @@
return func;
}
-static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *dp,
+static char *rna_def_property_end_func(FILE *f, StructRNA *srna, PropertyRNA *prop, PropertyDefRNA *UNUSED(dp),
const char *manualfunc)
{
char *func;
@@ -2006,7 +2013,7 @@
fprintf(f, "};\n\n");
}
-static void rna_generate_property_prototypes(BlenderRNA *brna, StructRNA *srna, FILE *f)
+static void rna_generate_property_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
{
PropertyRNA *prop;
StructRNA *base;
@@ -2029,7 +2036,7 @@
fprintf(f, "\n");
}
-static void rna_generate_parameter_prototypes(BlenderRNA *brna, StructRNA *srna, FunctionRNA *func, FILE *f)
+static void rna_generate_parameter_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FunctionRNA *func, FILE *f)
{
PropertyRNA *parm;
@@ -2068,7 +2075,7 @@
fprintf(f, "\n");
}
-static void rna_generate_static_parameter_prototypes(BlenderRNA *brna, StructRNA *srna, FunctionDefRNA *dfunc, FILE *f)
+static void rna_generate_static_parameter_prototypes(BlenderRNA *UNUSED(brna), StructRNA *srna, FunctionDefRNA *dfunc, FILE *f)
{
FunctionRNA *func;
PropertyDefRNA *dparm;
@@ -2483,7 +2490,7 @@
}
}
-static void rna_generate_struct(BlenderRNA *brna, StructRNA *srna, FILE *f)
+static void rna_generate_struct(BlenderRNA *UNUSED(brna), StructRNA *srna, FILE *f)
{
FunctionRNA *func;
FunctionDefRNA *dfunc;
@@ -2761,7 +2768,7 @@
}
}
-static void rna_generate_header(BlenderRNA *brna, FILE *f)
+static void rna_generate_header(BlenderRNA *UNUSED(brna), FILE *f)
{
StructDefRNA *ds;
PropertyDefRNA *dp;
@@ -2929,7 +2936,7 @@
"};\n"
"\n";
-static void rna_generate_header_cpp(BlenderRNA *brna, FILE *f)
+static void rna_generate_header_cpp(BlenderRNA *UNUSED(brna), FILE *f)
{
StructDefRNA *ds;
PropertyDefRNA *dp;
Modified: trunk/blender/source/blender/makesrna/intern/rna_define.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_define.c 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/makesrna/intern/rna_define.c 2012-06-28 12:32:06 UTC (rev 48372)
@@ -497,6 +497,9 @@
ext->free(ext->data); /* decref's the PyObject that the srna owns */
RNA_struct_blender_type_set(srna, NULL); /* this gets accessed again - XXX fixme */
RNA_struct_py_type_set(srna, NULL); /* NULL the srna's value so RNA_struct_free wont complain of a leak */
+#else
+ (void)srna;
+ (void)ext;
#endif
}
Modified: trunk/blender/source/blender/makesrna/intern/rna_scene.c
===================================================================
--- trunk/blender/source/blender/makesrna/intern/rna_scene.c 2012-06-28 11:20:19 UTC (rev 48371)
+++ trunk/blender/source/blender/makesrna/intern/rna_scene.c 2012-06-28 12:32:06 UTC (rev 48372)
@@ -736,7 +736,7 @@
}
static EnumPropertyItem *rna_ImageFormatSettings_file_format_itemf(bContext *C, PointerRNA *ptr,
- PropertyRNA *UNUSED(prop), int *free)
+ PropertyRNA *UNUSED(prop), int *UNUSED(free))
{
ID *id = ptr->id.data;
@@ Diff output truncated at 10240 characters. @@
More information about the Bf-blender-cvs
mailing list