Skip to content

Commit

Permalink
UPBGE: Fix __func__ usage on MSVC.
Browse files Browse the repository at this point in the history
  • Loading branch information
panzergame committed Jul 31, 2018
1 parent 727c1fb commit ce3a765
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions source/gameengine/Ketsji/KX_Mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@
#include "EXP_ListWrapper.h"

#include "BLI_kdopbvh.h"
#include "BLI_compiler_compat.h" // For MSVC __func__

#include "MEM_guardedalloc.h"

Expand Down

12 comments on commit ce3a765

@joelgomes1994
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunatelly this fix don't work, it keeps raising the error. I've appended the build log below, but the only important message was already shown before. The "" fix still works, though.

5>------ Build started: Project: python_numpy, Configuration: Release x64 ------
1>  KX_Mesh.cpp
3>  Generating buildinfo.h_fake, buildinfo.h
1>C:\blenderdev\blender\source\gameengine\Ketsji\KX_Mesh.cpp(421): error C2059: syntax error: ')'
6>------ Build started: Project: buildinfoobj, Configuration: Release x64 ------

log.txt

@lordloki
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will compile it with msvc 2015 later

@lordloki
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This workaround works:

const char *function_macro = __func__; //Workaround for MSVC2015
float (*coords)[3] = (float (*)[3])MEM_mallocN(sizeof(float[3]) * numVert, function_macro);

@panzergame
Copy link
Contributor Author

@panzergame panzergame commented on ce3a765 Aug 3, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And if you cast the value of __func__ this way:

float (*coords)[3] = (float (*)[3])MEM_mallocN(sizeof(float[3]) * numVert, (const char *)(__func__));

Did you try to put __func__ in parenthesis ?

Else we knock the hell door…

@joelgomes1994
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lordloki Your workaround works fine.
@panzergame Your workaround still raises the same error.

@lordloki
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panzergame as @joelgomes1994 said all your workarounds doesn't work. :-(

@lordloki
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it is something related to (float (*)[3])

@panzergame
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lordloki, @youle31 : What if MEM_mallocN is in parenthesis ?

@lordloki
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panzergame sry no access to my computer until this night/tomorrow morning

@youle31
Copy link
Collaborator

@youle31 youle31 commented on ce3a765 Aug 9, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have only Visual Studio 2017 installed and no compilation error

@lordloki
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@panzergame same error than before. Only thing that works it is the workaround I pointed before

@panzergame
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's sign for it…

Please sign in to comment.