Permalink
Browse files

blender core now compiles as c++. TODO fix linker stage error.

[ 94%] Linking C executable ../../../../bin/makesrna
CMakeFiles/makesrna.dir/rna_define.c.o:rna_define.c:function RNA_create: error: undefined reference to 'DNAlen'
CMakeFiles/makesrna.dir/rna_define.c.o:rna_define.c:function RNA_create: error: undefined reference to 'DNAstr'
../../../../lib/libbf_dna.a(dna_genfile.c.o):dna_genfile.c:function DNA_sdna_current_init(): error: undefined reference to 'DNAlen'
../../../../lib/libbf_dna.a(dna_genfile.c.o):dna_genfile.c:function DNA_sdna_current_init(): error: undefined reference to 'DNAstr'
collect2: error: ld returned 1 exit status
  • Loading branch information...
raptor raptor
raptor authored and raptor committed May 20, 2017
1 parent fe0ca1d commit 98ec11443d3bc799adfe2558d25d313e1651847d
Showing with 207 additions and 213 deletions.
  1. +1 −1 CMakeLists.txt
  2. +1 −2 source/blender/blenkernel/intern/dynamicpaint.c
  3. +2 −2 source/blender/blenkernel/intern/group.c
  4. +1 −1 source/blender/blenkernel/intern/idprop.c
  5. +11 −5 source/blender/blenkernel/intern/mesh.c
  6. +34 −34 source/blender/blenkernel/intern/mesh_evaluate.c
  7. +31 −31 source/blender/blenkernel/intern/mesh_mapping.c
  8. +40 −39 source/blender/blenkernel/intern/mesh_remap.c
  9. +3 −3 source/blender/blenkernel/intern/object_dupli.c
  10. +6 −9 source/blender/blenkernel/intern/pbvh.c
  11. +7 −7 source/blender/blenkernel/intern/shrinkwrap.c
  12. +5 −5 source/blender/blenkernel/intern/smoke.c
  13. +1 −1 source/blender/blenkernel/intern/text.c
  14. +3 −1 source/blender/blenkernel/intern/unit.c
  15. +0 −20 source/blender/blenlib/BLI_strict_flags.h
  16. +3 −3 source/blender/blenlib/intern/bitmap_draw_2d.c
  17. +2 −2 source/blender/blenlib/intern/boxpack2d.c
  18. +2 −1 source/blender/blenlib/intern/callbacks.c
  19. +5 −5 source/blender/blenlib/intern/convexhull2d.c
  20. +10 −6 source/blender/blenlib/intern/math_matrix.c
  21. +20 −19 source/blender/blenlib/intern/string.c
  22. +3 −3 source/blender/blenlib/intern/string_cursor_utf8.c
  23. +3 −3 source/blender/blenlib/intern/string_utf8.c
  24. +2 −1 source/blender/gpu/GPU_compositing.h
  25. +3 −3 source/blender/makesrna/intern/makesrna.c
  26. +1 −1 source/blender/makesrna/intern/rna_screen.c
  27. +3 −3 source/blender/modifiers/intern/MOD_solidify.c
  28. +4 −2 source/blender/render/extern/include/RE_pipeline.h
View
@@ -1641,7 +1641,7 @@ endif()
#set(CMAKE_C_FLAGS "-fpermissive -std=c++11 ${CMAKE_C_FLAGS}")
-set(CMAKE_C_FLAGS "-fpermissive -std=c++11 -Wall -Wcast-align -Wsign-conversion -Werror=implicit-function-declaration -Werror=return-type -Werror=vla -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings -Wlogical-op -Wundef -Winit-self -Wnonnull -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -Wformat-signedness -Wuninitialized -Wredundant-decls -Wshadow -Wno-error=unused-but-set-variable -fuse-ld=gold -fopenmp -std=gnu11 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -msse2")
+set(CMAKE_C_FLAGS "-fpermissive -std=c++11 -Wall -Wconversion -Wcast-align -Wsign-conversion -Werror=implicit-function-declaration -Werror=return-type -Werror=vla -Wstrict-prototypes -Wmissing-prototypes -Wno-char-subscripts -Wno-unknown-pragmas -Wpointer-arith -Wunused-parameter -Wwrite-strings -Wlogical-op -Wundef -Winit-self -Wnonnull -Wmissing-include-dirs -Wno-div-by-zero -Wtype-limits -Wformat-signedness -Wuninitialized -Wredundant-decls -Wshadow -Wno-error=unused-but-set-variable -fuse-ld=gold -fopenmp -std=gnu11 -msse -pipe -fPIC -funsigned-char -fno-strict-aliasing -msse2")
message(STATUS "Using CFLAGS: ${CMAKE_C_FLAGS}")
@@ -1391,8 +1391,7 @@ typedef struct DynamicPaintSetInitColorData {
MLoopTri *mlooptri;
MLoopCol *mloopcol;
struct ImagePool *pool;
-
- const bool scene_color_manage;
+ bool scene_color_manage;
} DynamicPaintSetInitColorData;
static void dynamic_paint_set_init_color_tex_to_vcol_cb(void *userdata, const int i)
@@ -418,7 +418,7 @@ static int group_material_unlink_internal(Group *group, Material *ob) {
go = group->gmaterial.first;
while (go) {
- gon = go->next;
+ gon = (GroupObjectMaterial*)go->next;
if (go->material == ob) {
BLI_remlink(&group->gmaterial, go);
//TODO//free_group_object(go);
@@ -510,7 +510,7 @@ static int group_texture_unlink_internal(Group *group, Tex *ob) {
go = group->gtexture.first;
while (go) {
- gon = go->next;
+ gon = (GroupObjectTexture*)go->next;
if (go->texture == ob) {
BLI_remlink(&group->gtexture, go);
//TODO//free_group_object(go);
@@ -201,7 +201,7 @@ void IDP_ResizeIDPArray(IDProperty *prop, int newlen)
*/
newsize = newlen;
newsize = (newsize >> 3) + (newsize < 9 ? 3 : 6) + newsize;
- prop->data.pointer = MEM_recallocN(prop->data.pointer, sizeof(IDProperty) * (size_t)newsize);
+ prop->data.pointer = MEM_recallocN(prop->data.pointer, sizeof(IDProperty) * (size_t)(unsigned int)newsize);
prop->len = newlen;
prop->totallen = newsize;
}
@@ -543,12 +543,18 @@ BMesh *BKE_mesh_to_bmesh(
BMesh *bm;
const BMAllocTemplate allocsize = BMALLOC_TEMPLATE_FROM_ME(me);
- bm = BM_mesh_create(&allocsize, params);
+ //BM_mesh_bm_from_me( bm, me,
+ // (&(struct BMeshFromMeshParams){
+ // .add_key_index = add_key_index, .use_shapekey = true, .active_shapekey = ob->shapenr,
+ // })
+ //);
- BM_mesh_bm_from_me(
- bm, me, (&(struct BMeshFromMeshParams){
- .add_key_index = add_key_index, .use_shapekey = true, .active_shapekey = ob->shapenr,
- }));
+ bm = BM_mesh_create(&allocsize, params);
+ BMeshFromMeshParams bparams = {};
+ bparams.add_key_index = add_key_index;
+ bparams.use_shapekey = true;
+ bparams.active_shapekey = ob->shapenr;
+ BM_mesh_bm_from_me( bm, me, &bparams );
return bm;
}
@@ -127,7 +127,7 @@ void BKE_mesh_calc_normals_mapping_ex(
return;
}
- if (!pnors) pnors = MEM_callocN(sizeof(float[3]) * (size_t)numPolys, __func__);
+ if (!pnors) pnors = MEM_callocN(sizeof(float[3]) * (size_t)(unsigned int)numPolys, __func__);
/* if (!fnors) fnors = MEM_callocN(sizeof(float[3]) * numFaces, "face nors mesh.c"); */ /* NO NEED TO ALLOC YET */
@@ -196,7 +196,7 @@ static void mesh_calc_normals_poly_accum_task_cb(void *userdata, const int pidx)
float (*vnors)[3] = data->vnors;
const int nverts = mp->totloop;
- float (*edgevecbuf)[3] = BLI_array_alloca(edgevecbuf, (size_t)nverts);
+ float (*edgevecbuf)[3] = BLI_array_alloca(edgevecbuf, (size_t)(unsigned int)nverts);
int i;
/* Polygon Normal and edge-vector */
@@ -271,11 +271,11 @@ void BKE_mesh_calc_normals_poly(
/* first go through and calculate normals for all the polys */
if (vnors == NULL) {
- vnors = MEM_callocN(sizeof(*vnors) * (size_t)numVerts, __func__);
+ vnors = MEM_callocN(sizeof(*vnors) * (size_t)(unsigned int)numVerts, __func__);
free_vnors = true;
}
else {
- memset(vnors, 0, sizeof(*vnors) * (size_t)numVerts);
+ memset(vnors, 0, sizeof(*vnors) * (size_t)(unsigned int)numVerts);
}
MeshCalcNormalsData data = {
@@ -319,8 +319,8 @@ void BKE_mesh_calc_normals_tessface(
const MFace *mfaces, int numFaces,
float (*r_faceNors)[3])
{
- float (*tnorms)[3] = MEM_callocN(sizeof(*tnorms) * (size_t)numVerts, "tnorms");
- float (*fnors)[3] = (r_faceNors) ? r_faceNors : MEM_callocN(sizeof(*fnors) * (size_t)numFaces, "meshnormals");
+ float (*tnorms)[3] = MEM_callocN(sizeof(*tnorms) * (size_t)(unsigned int)numVerts, "tnorms");
+ float (*fnors)[3] = (r_faceNors) ? r_faceNors : MEM_callocN(sizeof(*fnors) * (size_t)(unsigned int)numFaces, "meshnormals");
int i;
for (i = 0; i < numFaces; i++) {
@@ -362,8 +362,8 @@ void BKE_mesh_calc_normals_looptri(
const MLoopTri *looptri, int looptri_num,
float (*r_tri_nors)[3])
{
- float (*tnorms)[3] = MEM_callocN(sizeof(*tnorms) * (size_t)numVerts, "tnorms");
- float (*fnors)[3] = (r_tri_nors) ? r_tri_nors : MEM_callocN(sizeof(*fnors) * (size_t)looptri_num, "meshnormals");
+ float (*tnorms)[3] = MEM_callocN(sizeof(*tnorms) * (size_t)(unsigned int)numVerts, "tnorms");
+ float (*fnors)[3] = (r_tri_nors) ? r_tri_nors : MEM_callocN(sizeof(*fnors) * (size_t)(unsigned int)looptri_num, "meshnormals");
int i;
for (i = 0; i < looptri_num; i++) {
@@ -411,8 +411,8 @@ void BKE_lnor_spacearr_init(MLoopNorSpaceArray *lnors_spacearr, const int numLoo
lnors_spacearr->mem = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
}
mem = lnors_spacearr->mem;
- lnors_spacearr->lspacearr = BLI_memarena_calloc(mem, sizeof(MLoopNorSpace *) * (size_t)numLoops);
- lnors_spacearr->loops_pool = BLI_memarena_alloc(mem, sizeof(LinkNode) * (size_t)numLoops);
+ lnors_spacearr->lspacearr = BLI_memarena_calloc(mem, sizeof(MLoopNorSpace *) * (size_t)(unsigned int)numLoops);
+ lnors_spacearr->loops_pool = BLI_memarena_alloc(mem, sizeof(LinkNode) * (size_t)(unsigned int)numLoops);
}
}
@@ -1196,10 +1196,10 @@ void BKE_mesh_normals_loop_split(
* store the negated value of loop index instead of INDEX_INVALID to retrieve the real value later in code).
* Note also that lose edges always have both values set to 0!
*/
- int (*edge_to_loops)[2] = MEM_callocN(sizeof(int[2]) * (size_t)numEdges, __func__);
+ int (*edge_to_loops)[2] = MEM_callocN(sizeof(int[2]) * (size_t)(unsigned int)numEdges, __func__);
/* Simple mapping from a loop to its polygon index. */
- int *loop_to_poly = r_loop_to_poly ? r_loop_to_poly : MEM_mallocN(sizeof(int) * (size_t)numLoops, __func__);
+ int *loop_to_poly = r_loop_to_poly ? r_loop_to_poly : MEM_mallocN(sizeof(int) * (size_t)(unsigned int)numLoops, __func__);
MPoly *mp;
int mp_index, me_index;
@@ -1231,7 +1231,7 @@ void BKE_mesh_normals_loop_split(
}
if (r_lnors_spacearr) {
BKE_lnor_spacearr_init(r_lnors_spacearr, numLoops);
- sharp_verts = BLI_BITMAP_NEW((size_t)numVerts, __func__);
+ sharp_verts = BLI_BITMAP_NEW((size_t)(unsigned int)numVerts, __func__);
}
/* This first loop check which edges are actually smooth, and compute edge vectors. */
@@ -1386,9 +1386,9 @@ static void mesh_normals_loop_custom_set(
* So better to keep some simplicity here, and just call BKE_mesh_normals_loop_split() twice!
*/
MLoopNorSpaceArray lnors_spacearr = {NULL};
- BLI_bitmap *done_loops = BLI_BITMAP_NEW((size_t)numLoops, __func__);
- float (*lnors)[3] = MEM_callocN(sizeof(*lnors) * (size_t)numLoops, __func__);
- int *loop_to_poly = MEM_mallocN(sizeof(int) * (size_t)numLoops, __func__);
+ BLI_bitmap *done_loops = BLI_BITMAP_NEW((size_t)(unsigned int)numLoops, __func__);
+ float (*lnors)[3] = MEM_callocN(sizeof(*lnors) * (size_t)(unsigned int)numLoops, __func__);
+ int *loop_to_poly = MEM_mallocN(sizeof(int) * (size_t)(unsigned int)numLoops, __func__);
/* In this case we always consider split nors as ON, and do not want to use angle to define smooth fans! */
const bool use_split_normals = true;
const float split_angle = (float)M_PI;
@@ -1508,7 +1508,7 @@ static void mesh_normals_loop_custom_set(
&lnors_spacearr, NULL, loop_to_poly);
}
else {
- BLI_BITMAP_SET_ALL(done_loops, true, (size_t)numLoops);
+ BLI_BITMAP_SET_ALL(done_loops, true, (size_t)(unsigned int)numLoops);
}
/* And we just have to convert plain object-space custom normals to our lnor space-encoded ones. */
@@ -1603,7 +1603,7 @@ void BKE_mesh_normals_loop_to_vertex(
const MLoop *ml;
int i;
- int *vert_loops_nbr = MEM_callocN(sizeof(*vert_loops_nbr) * (size_t)numVerts, __func__);
+ int *vert_loops_nbr = MEM_callocN(sizeof(*vert_loops_nbr) * (size_t)(unsigned int)numVerts, __func__);
copy_vn_fl((float *)r_vert_clnors, 3 * numVerts, 0.0f);
@@ -1943,7 +1943,7 @@ float BKE_mesh_calc_poly_area(
int i;
const MLoop *l_iter = loopstart;
float area;
- float (*vertexcos)[3] = BLI_array_alloca(vertexcos, (size_t)mpoly->totloop);
+ float (*vertexcos)[3] = BLI_array_alloca(vertexcos, (size_t)(unsigned int)mpoly->totloop);
/* pack vertex cos into an array for area_poly_v3 */
for (i = 0; i < mpoly->totloop; i++, l_iter++) {
@@ -2500,9 +2500,9 @@ int BKE_mesh_recalc_tessellation(
/* allocate the length of totfaces, avoid many small reallocs,
* if all faces are tri's it will be correct, quads == 2x allocs */
/* take care. we are _not_ calloc'ing so be sure to initialize each field */
- mface_to_poly_map = MEM_mallocN(sizeof(*mface_to_poly_map) * (size_t)looptri_num, __func__);
- mface = MEM_mallocN(sizeof(*mface) * (size_t)looptri_num, __func__);
- lindices = MEM_mallocN(sizeof(*lindices) * (size_t)looptri_num, __func__);
+ mface_to_poly_map = MEM_mallocN(sizeof(*mface_to_poly_map) * (size_t)(unsigned int)looptri_num, __func__);
+ mface = MEM_mallocN(sizeof(*mface) * (size_t)(unsigned int)looptri_num, __func__);
+ lindices = MEM_mallocN(sizeof(*lindices) * (size_t)(unsigned int)looptri_num, __func__);
mface_index = 0;
mp = mpoly;
@@ -2593,8 +2593,8 @@ int BKE_mesh_recalc_tessellation(
arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
}
- tris = BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)totfilltri);
- projverts = BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)mp_totloop);
+ tris = BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)(unsigned int)totfilltri);
+ projverts = BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)(unsigned int)mp_totloop);
zero_v3(normal);
@@ -2666,8 +2666,8 @@ int BKE_mesh_recalc_tessellation(
/* not essential but without this we store over-alloc'd memory in the CustomData layers */
if (LIKELY(looptri_num != totface)) {
- mface = MEM_reallocN(mface, sizeof(*mface) * (size_t)totface);
- mface_to_poly_map = MEM_reallocN(mface_to_poly_map, sizeof(*mface_to_poly_map) * (size_t)totface);
+ mface = MEM_reallocN(mface, sizeof(*mface) * (size_t)(unsigned int)totface);
+ mface_to_poly_map = MEM_reallocN(mface_to_poly_map, sizeof(*mface_to_poly_map) * (size_t)(unsigned int)totface);
}
CustomData_add_layer(fdata, CD_MFACE, CD_ASSIGN, mface, totface);
@@ -2792,8 +2792,8 @@ void BKE_mesh_recalc_looptri(
arena = BLI_memarena_new(BLI_MEMARENA_STD_BUFSIZE, __func__);
}
- tris = BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)totfilltri);
- projverts = BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)mp_totloop);
+ tris = BLI_memarena_alloc(arena, sizeof(*tris) * (size_t)(unsigned int)totfilltri);
+ projverts = BLI_memarena_alloc(arena, sizeof(*projverts) * (size_t)(unsigned int)mp_totloop);
zero_v3(normal);
@@ -2882,7 +2882,7 @@ int BKE_mesh_mpoly_to_mface(struct CustomData *fdata, struct CustomData *ldata,
const bool hasLNor = CustomData_has_layer(ldata, CD_NORMAL);
/* over-alloc, ngons will be skipped */
- mface = MEM_mallocN(sizeof(*mface) * (size_t)totpoly, __func__);
+ mface = MEM_mallocN(sizeof(*mface) * (size_t)(unsigned int)totpoly, __func__);
mpoly = CustomData_get_layer(pdata, CD_MPOLY);
mloop = CustomData_get_layer(ldata, CD_MLOOP);
@@ -3050,7 +3050,7 @@ static void bm_corners_to_loops_ex(ID *id, CustomData *fdata, CustomData *ldata,
else {
const int side = (int)sqrtf((float)(fd->totdisp / corners));
const int side_sq = side * side;
- const size_t disps_size = sizeof(float[3]) * (size_t)side_sq;
+ const size_t disps_size = sizeof(float[3]) * (size_t)(unsigned int)side_sq;
for (i = 0; i < tot; i++, disps += side_sq, ld++) {
ld->totdisp = side_sq;
@@ -3126,7 +3126,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
CustomData_free(pdata, totpoly_i);
totpoly = totface_i;
- mpoly = MEM_callocN(sizeof(MPoly) * (size_t)totpoly, "mpoly converted");
+ mpoly = MEM_callocN(sizeof(MPoly) * (size_t)(unsigned int)totpoly, "mpoly converted");
CustomData_add_layer(pdata, CD_MPOLY, CD_ASSIGN, mpoly, totpoly);
numTex = CustomData_number_of_layers(fdata, CD_MTFACE);
@@ -3138,7 +3138,7 @@ void BKE_mesh_convert_mfaces_to_mpolys_ex(ID *id, CustomData *fdata, CustomData
totloop += mf->v4 ? 4 : 3;
}
- mloop = MEM_callocN(sizeof(MLoop) * (size_t)totloop, "mloop converted");
+ mloop = MEM_callocN(sizeof(MLoop) * (size_t)(unsigned int)totloop, "mloop converted");
CustomData_add_layer(ldata, CD_MLOOP, CD_ASSIGN, mloop, totloop);
@@ -3537,9 +3537,9 @@ void BKE_mesh_calc_relative_deform(
const MPoly *mp;
int i;
- int *vert_accum = MEM_callocN(sizeof(*vert_accum) * (size_t)totvert, __func__);
+ int *vert_accum = MEM_callocN(sizeof(*vert_accum) * (size_t)(unsigned int)totvert, __func__);
- memset(vert_cos_new, '\0', sizeof(*vert_cos_new) * (size_t)totvert);
+ memset(vert_cos_new, '\0', sizeof(*vert_cos_new) * (size_t)(unsigned int)totvert);
for (i = 0, mp = mpoly; i < totpoly; i++, mp++) {
const MLoop *loopstart = mloop + mp->loopstart;
Oops, something went wrong.

0 comments on commit 98ec114

Please sign in to comment.