GCC and Clang compatible on Windows
Made simple modifications so that project can be compiled wiith Clang and GCC on Windows
@wolfpld, I finished changing source so it compiles with gcc and clang on Windows. I tested it on both compilers, test program that uses Tracy, and Tracy profiler itself compile successfully. The initial problem with safe memcpy is solved using pipes for data transfer similar to linux implementation. I wasn't able to find fix for too many sections that I mentioned before and just disabled CMAKE_INTERPROCEDURAL_OPTIMIZATION when compiling with gcc.
@wolfpld Fixed things you pointed out and some other minor things.
@FilipNur Your PR rewrites the entire TracyProfiler.cpp file. Can you fix that?
@mcourteaux I know and I don't know why. I will push changes when I resolve this issue.
As I can't assess what your PR does due to this issue, make sure it's still relevant after my last PR was merged.
@mcourteaux I see that your pull request is also about mingw compatibility so my pull request might be not needed, as I was trying to achieve something similar. But I have one question: in your changes to TracyProfiler.cpp you did
#ifdef _WIN32
+ # ifdef _MSC_VER
__try
{
memcpy( buf, data, size );
{
success = false;
}
+ # else
+ memcpy( buf, data, size );
+ # endif
#else
...
Where the memcpy, that is executed if _MSC_VER is not defined, is not protected against potential segfault. I am just curious why was it merged, because when I proposed just bare memcpy in first request, @wolfpld sent me to #889, whetre issue says about ensuring safe memcpy.
It's an incremental step.
Fixed line endings in public/client/TracyProfiler.cpp and rebased project to latest master branch.
@FilipNur You seem to have made a PR that includes a bunch of commits that are already on master. If you struggle with figuring out how to correct things, a very manual trick I have used once or twice, that resolves this very easily, is to generate a git diff --patch master gcc_and_clang_compatible patch file from your changes between master and your work. The patch file will contain all changes between those to commits, regardless of the history that happened between them. Then you make a new branch, forked from master, (let's say it's called my-temp-branch) and you apply the patch file there. Afterwards you can inspect if everything looks fine, and your new branch seems like the changes you want to commit. Make a commit on that new branch. Now go back to your gcc_and_clang_compatible branch, and git reset --hard my-temp-branch. Git will now ignore your messy git commit history, and have one commit on your gcc_and_clang_compatible branch which is just the patch file you applied.
If you mess up any of the steps, there is always git reflog to find your work back.
Thanks @mcourteaux, I cleaned up the code using your method.
@wolfpld Could you check it?
You are still changing way too much code for no reason, especially in external libraries, and there are comments you have not addressed properly. What's there to check?