[Bf-blender-cvs] [a372638a76e] master: Cleanup: use static vars where appropriate

Campbell Barton noreply at git.blender.org
Tue Aug 1 01:08:09 CEST 2017


Commit: a372638a76e05aaa44589845680c15a7f09a7f1e
Author: Campbell Barton
Date:   Tue Aug 1 09:06:34 2017 +1000
Branches: master
https://developer.blender.org/rBa372638a76e05aaa44589845680c15a7f09a7f1e

Cleanup: use static vars where appropriate

===================================================================

M	source/blender/blenkernel/intern/object_dupli.c
M	source/blender/bmesh/intern/bmesh_core.c
M	source/blender/compositor/operations/COM_RenderLayersProg.cpp
M	source/blender/datatoc/datatoc.c
M	source/blender/editors/animation/keyframes_general.c
M	source/blender/editors/gpencil/editaction_gpencil.c
M	source/blender/editors/gpencil/gpencil_edit.c
M	source/blender/editors/sculpt_paint/paint_ops.c
M	source/blender/editors/space_clip/space_clip.c
M	source/blender/editors/space_sequencer/space_sequencer.c
M	source/blender/gpu/intern/gpu_buffers.c
M	source/blender/makesrna/RNA_enum_types.h
M	source/blender/makesrna/intern/CMakeLists.txt
M	source/blender/makesrna/intern/rna_mesh.c
M	source/blender/makesrna/intern/rna_scene.c
M	source/blender/makesrna/intern/rna_sculpt_paint.c
M	source/blender/modifiers/intern/MOD_build.c
M	source/blender/modifiers/intern/MOD_collision.c
M	source/blender/modifiers/intern/MOD_curve.c
M	source/blender/modifiers/intern/MOD_dynamicpaint.c
M	source/blender/modifiers/intern/MOD_edgesplit.c
M	source/blender/modifiers/intern/MOD_explode.c
M	source/blender/modifiers/intern/MOD_fluidsim.c
M	source/blender/modifiers/intern/MOD_mask.c
M	source/blender/modifiers/intern/MOD_mirror.c
M	source/blender/modifiers/intern/MOD_multires.c
M	source/blender/modifiers/intern/MOD_ocean.c
M	source/blender/modifiers/intern/MOD_particleinstance.c
M	source/blender/modifiers/intern/MOD_skin.c
M	source/blender/modifiers/intern/MOD_smoke.c
M	source/blender/modifiers/intern/MOD_triangulate.c
M	source/blender/modifiers/intern/MOD_weightvgedit.c
M	source/blender/modifiers/intern/MOD_weightvgmix.c
M	source/blender/modifiers/intern/MOD_weightvgproximity.c

===================================================================

diff --git a/source/blender/blenkernel/intern/object_dupli.c b/source/blender/blenkernel/intern/object_dupli.c
index 076bef71875..b49e481b068 100644
--- a/source/blender/blenkernel/intern/object_dupli.c
+++ b/source/blender/blenkernel/intern/object_dupli.c
@@ -343,7 +343,7 @@ static void make_duplis_group(const DupliContext *ctx)
 	}
 }
 
-const DupliGenerator gen_dupli_group = {
+static const DupliGenerator gen_dupli_group = {
     OB_DUPLIGROUP,                  /* type */
     make_duplis_group               /* make_duplis */
 };
@@ -421,7 +421,7 @@ static void make_duplis_frames(const DupliContext *ctx)
 	*ob = copyob;
 }
 
-const DupliGenerator gen_dupli_frames = {
+static const DupliGenerator gen_dupli_frames = {
     OB_DUPLIFRAMES,                 /* type */
     make_duplis_frames              /* make_duplis */
 };
@@ -571,7 +571,7 @@ static void make_duplis_verts(const DupliContext *ctx)
 	vdd.dm->release(vdd.dm);
 }
 
-const DupliGenerator gen_dupli_verts = {
+static const DupliGenerator gen_dupli_verts = {
     OB_DUPLIVERTS,                  /* type */
     make_duplis_verts               /* make_duplis */
 };
@@ -684,7 +684,7 @@ static void make_duplis_font(const DupliContext *ctx)
 	MEM_freeN(chartransdata);
 }
 
-const DupliGenerator gen_dupli_verts_font = {
+static const DupliGenerator gen_dupli_verts_font = {
     OB_DUPLIVERTS,                  /* type */
     make_duplis_font                /* make_duplis */
 };
@@ -847,7 +847,7 @@ static void make_duplis_faces(const DupliContext *ctx)
 	fdd.dm->release(fdd.dm);
 }
 
-const DupliGenerator gen_dupli_faces = {
+static const DupliGenerator gen_dupli_faces = {
     OB_DUPLIFACES,                  /* type */
     make_duplis_faces               /* make_duplis */
 };
@@ -1168,7 +1168,7 @@ static void make_duplis_particles(const DupliContext *ctx)
 	}
 }
 
-const DupliGenerator gen_dupli_particles = {
+static const DupliGenerator gen_dupli_particles = {
     OB_DUPLIPARTS,                  /* type */
     make_duplis_particles           /* make_duplis */
 };
diff --git a/source/blender/bmesh/intern/bmesh_core.c b/source/blender/bmesh/intern/bmesh_core.c
index 4fe14fdf5c9..6b22fd0a85c 100644
--- a/source/blender/bmesh/intern/bmesh_core.c
+++ b/source/blender/bmesh/intern/bmesh_core.c
@@ -2415,7 +2415,8 @@ static void bmesh_kernel_vert_separate__cleanup(BMesh *bm, LinkNode *edges_separ
 					/* don't visit again */
 					n_prev->next = n_step->next;
 				}
-			} while ((n_prev = n_step),
+			} while ((void)
+			         (n_prev = n_step),
 			         (n_step = n_step->next));
 
 		} while ((n_orig = n_orig->next) && n_orig->next);
diff --git a/source/blender/compositor/operations/COM_RenderLayersProg.cpp b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
index f2f1b211a97..26654b31e16 100644
--- a/source/blender/compositor/operations/COM_RenderLayersProg.cpp
+++ b/source/blender/compositor/operations/COM_RenderLayersProg.cpp
@@ -246,4 +246,4 @@ void RenderLayersDepthProg::executePixelSampled(float output[4], float x, float
 		unsigned int offset = (iy * this->getWidth() + ix);
 		output[0] = inputBuffer[offset];
 	}
-}
\ No newline at end of file
+}
diff --git a/source/blender/datatoc/datatoc.c b/source/blender/datatoc/datatoc.c
index 4e49a9a7694..ffccca98f99 100644
--- a/source/blender/datatoc/datatoc.c
+++ b/source/blender/datatoc/datatoc.c
@@ -91,6 +91,11 @@ int main(int argc, char **argv)
 	}
 
 	fprintf(fpout, "/* DataToC output of file <%s> */\n\n", argv[1]);
+
+	/* Quiet 'missing-variable-declarations' warning. */
+	fprintf(fpout, "extern int datatoc_%s_size;\n", argv[1]);
+	fprintf(fpout, "extern char datatoc_%s[];\n\n", argv[1]);
+
 	fprintf(fpout, "int datatoc_%s_size = %d;\n", argv[1], (int)size);
 	fprintf(fpout, "char datatoc_%s[] = {\n", argv[1]);
 	while (size--) {
diff --git a/source/blender/editors/animation/keyframes_general.c b/source/blender/editors/animation/keyframes_general.c
index c1e82583521..071c5fab9d7 100644
--- a/source/blender/editors/animation/keyframes_general.c
+++ b/source/blender/editors/animation/keyframes_general.c
@@ -52,6 +52,7 @@
 #include "BKE_deform.h"
 
 #include "RNA_access.h"
+#include "RNA_enum_types.h"
 
 #include "ED_anim_api.h"
 #include "ED_keyframing.h"
diff --git a/source/blender/editors/gpencil/editaction_gpencil.c b/source/blender/editors/gpencil/editaction_gpencil.c
index bd4856f1b93..9227f9b1097 100644
--- a/source/blender/editors/gpencil/editaction_gpencil.c
+++ b/source/blender/editors/gpencil/editaction_gpencil.c
@@ -314,7 +314,7 @@ void ED_gplayer_frames_keytype_set(bGPDlayer *gpl, short type)
  */
 
 /* globals for copy/paste data (like for other copy/paste buffers) */
-ListBase gp_anim_copybuf = {NULL, NULL};
+static ListBase gp_anim_copybuf = {NULL, NULL};
 static int gp_anim_copy_firstframe =  999999999;
 static int gp_anim_copy_lastframe  = -999999999;
 static int gp_anim_copy_cfra       =  0;
diff --git a/source/blender/editors/gpencil/gpencil_edit.c b/source/blender/editors/gpencil/gpencil_edit.c
index fc6df49cf6c..55a3fc09f2e 100644
--- a/source/blender/editors/gpencil/gpencil_edit.c
+++ b/source/blender/editors/gpencil/gpencil_edit.c
@@ -343,7 +343,7 @@ ListBase gp_strokes_copypastebuf = {NULL, NULL};
  * This is needed to prevent dangling and unsafe pointers when pasting across datablocks,
  * or after a color used by a stroke in the buffer gets deleted (via user action or undo).
  */
-GHash *gp_strokes_copypastebuf_colors = NULL;
+static GHash *gp_strokes_copypastebuf_colors = NULL;
 
 /* Free copy/paste buffer data */
 void ED_gpencil_strokes_copybuf_free(void)
diff --git a/source/blender/editors/sculpt_paint/paint_ops.c b/source/blender/editors/sculpt_paint/paint_ops.c
index f88b64129e7..123a70d5044 100644
--- a/source/blender/editors/sculpt_paint/paint_ops.c
+++ b/source/blender/editors/sculpt_paint/paint_ops.c
@@ -821,8 +821,6 @@ static int brush_uv_sculpt_tool_set_exec(bContext *C, wmOperator *op)
 
 static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot)
 {
-	/* from rna_scene.c */
-	extern EnumPropertyItem uv_sculpt_tool_items[];
 	/* identifiers */
 	ot->name = "UV Sculpt Tool Set";
 	ot->description = "Set the UV sculpt tool";
@@ -836,7 +834,7 @@ static void BRUSH_OT_uv_sculpt_tool_set(wmOperatorType *ot)
 	ot->flag = 0;
 
 	/* props */
-	ot->prop = RNA_def_enum(ot->srna, "tool", uv_sculpt_tool_items, 0, "Tool", "");
+	ot->prop = RNA_def_enum(ot->srna, "tool", rna_enum_uv_sculpt_tool_items, 0, "Tool", "");
 }
 
 /***** Stencil Control *****/
diff --git a/source/blender/editors/space_clip/space_clip.c b/source/blender/editors/space_clip/space_clip.c
index 237082f948b..597b8be89b2 100644
--- a/source/blender/editors/space_clip/space_clip.c
+++ b/source/blender/editors/space_clip/space_clip.c
@@ -821,7 +821,7 @@ static void clip_keymap(struct wmKeyConfig *keyconf)
 #endif
 }
 
-const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL};
+static const char *clip_context_dir[] = {"edit_movieclip", "edit_mask", NULL};
 
 static int clip_context(const bContext *C, const char *member, bContextDataResult *result)
 {
diff --git a/source/blender/editors/space_sequencer/space_sequencer.c b/source/blender/editors/space_sequencer/space_sequencer.c
index a2a80297041..f965c1af54a 100644
--- a/source/blender/editors/space_sequencer/space_sequencer.c
+++ b/source/blender/editors/space_sequencer/space_sequencer.c
@@ -435,7 +435,7 @@ static void sequencer_dropboxes(void)
 
 /* ************* end drop *********** */
 
-const char *sequencer_context_dir[] = {"edit_mask", NULL};
+static const char *sequencer_context_dir[] = {"edit_mask", NULL};
 
 static int sequencer_context(const bContext *C, const char *member, bContextDataResult *result)
 {
diff --git a/source/blender/gpu/intern/gpu_buffers.c b/source/blender/gpu/intern/gpu_buffers.c
index 9f1fe3a5a67..73c4d8a6804 100644
--- a/source/blender/gpu/intern/gpu_buffers.c
+++ b/source/blender/gpu/intern/gpu_buffers.c
@@ -76,7 +76,7 @@ typedef struct {
 
 static size_t gpu_buffer_size_from_type(DerivedMesh *dm, GPUBufferType type);
 
-const GPUBufferTypeSettings gpu_buffer_type_settings[] = {
+static const GPUBufferTypeSettings gpu_buffer_type_settings[] = {
     /* vertex */
     {GL_ARRAY_BUFFER, 3},
     /* normal */
diff --git a/source/blender/makesrna/RNA_enum_types.h b/source/blender/makesrna/RNA_enum_types.h
index 1c9b3593d17..f8e240d57bf 100644
--- a/source/blender/makesrna/RNA_enum_types.h
+++ b/source/blender/makesrna/RNA_enum_types.h
@@ -114,6 +114,8 @@ extern EnumPropertyItem rna_enum_brush_image_tool_items[];
 
 extern EnumPropertyItem rna_enum_gpencil_sculpt_brush_items[];
 
+extern EnumPropertyItem rna_enum_uv_sculpt_tool_items[];
+
 extern EnumPropertyItem rna_enum_axis_xy_items[];
 extern EnumPropertyItem rna_enum_axis_xyz_items[];
 
diff --git a/source/blender/makesrna/intern/CMakeLists.txt b/source/blender/makesrna/intern/CMakeLists.txt
index 6a08d762920..9d0ba5586af 100644
--- a/source/blender/makesrna/intern/CMakeLists.txt
+++ b/source/blender/makesrna/intern/CMakeLists.txt
@@ -140,6 +140,9 @@ set(GENSRC_CFLAGS)
 if(CMAKE_COMPILER_IS_GNUCC OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))
 	set(GENSRC_CFLAGS "-Wno-missing-prototypes")
 endif()
+if(CMAKE_C_COMPILER_ID MATCHES "Clang")
+	set(GENSRC_CFLAGS "${GENSRC_CFLAGS} -Wno-missing-variable-declarations")
+endif()
 
 if(GENSRC_CFLAGS)
 	set_source_files_properties(${GENSRC} PROPERTIES COMPILE_FLAGS "${GENSRC_CFLAGS}")
diff --git a/source/blender/makesrna/intern/rna_mesh.c b/source/blender/makesrna/intern/rna_mesh.c
index ad5f320625c..c25a70cea20 100644
--- a/source/blender/makesrna/intern/rna_mesh.c
+++ b/source/blender/makesrna/intern/rna_mesh.c
@@ -46,6 +46,7 @@
 #include "RNA_access.h"
 #include "RNA_define.h"
 #include "RNA_types.h"
+#include "RNA_enum_types.h"
 
 #include "rna_internal.h"
 
diff --git a/source/blender/makesrna/intern/rna_scene.c b/source/blender/makesrna/intern/rna_scene.c
index b9231574a24..8dd991a768b 100644
--- a/source/blender/makesrna/intern/rna_scene.c
+++ b/source/blender/makesrna/intern/rna_scene.c
@@ -94,13 +94,13 @@ EnumPropertyItem rna_enum_exr_codec_items[] = {
 };
 #endif
 
-EnumPropertyItem uv_sculpt_relaxation_items[] = {
+static EnumPropertyItem uv_s

@@ Diff output truncated at 10240 characters. @@




More information about the Bf-blender-cvs mailing list