-
Notifications
You must be signed in to change notification settings - Fork 107
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
CMake and no-warn MSVC support #118
base: release
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should target the develop
branch, as noted at the beginning of CONTRIBUTING.md
. master
will be renamed to release
eventually, changes are only merged there as part of versioned releases.
Should this be a draft PR? ("WiP but it currently builds fine on Windows (no warning).")
I currently don't use Windows at all, so I won't be able to test this.
@@ -56,6 +63,34 @@ TEST just_fail(void) { | |||
FAIL(); | |||
} | |||
|
|||
#if defined(_MSC_VER) || defined(__MINGW32__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rather than adding a substitute implementation of gettimeofday
here, it could just call GetSystemTime
and SystemTimeToFileTime
then use the milliseconds field. Actually replicating the overall behavior of gettimeofday
isn't important -- it's just grabbing a timestamp to use as a seed for example code.
greatest.h
Outdated
@@ -700,6 +700,99 @@ typedef enum greatest_test_res { | |||
prng->count_run = prng->random_order = prng->initialized = 0; \ | |||
} while(0) | |||
|
|||
#if defined(__STDC_LIB_EXT1__) || defined(_MSC_VER) || defined(__MINGW32__) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this really necessary? strnlen
and strncat
are in the C standard library.
Note the bit in the README about the LOC limit -- this would exceed that, considerably.
Also, it adds a substantial block of code with a different license. I'd really prefer to avoid doing that.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes but strnlen_s
and strncat_s
are missing.
Again happy to remove the code and just use a different macro-branch for MSVC, the goal is to get it to compile in MSVC without throwing any warnings related to https://learn.microsoft.com/en-us/cpp/c-runtime-library/security-features-in-the-crt
greatest/CMakeLists.txt
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should go in contrib/
, as should the cmake
directory, to make it clear that this is a contributed extension rather than something necessary for using it. I haven't used cmake much, so I won't actively maintain it myself.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Happy to move the cmake
directory to contrib
but without a CMakeLists.txt
in project root others cloning this repo won't realise that it has CMake integrated. E.g., whence cloning in an IDE like CLion.
… everything to this dir
…s per project owner's request
As a temporary workaround, this will at least make things compile:
However, it would be nice if Greatest used the security enhanced CRT functions when compiling for windows. I'd be happy to help with any testing etc if that would help push a fix through for next release. |
WiP but it currently builds fine on Windows (no warning).
PS: In terms of
strncat_s
I suppose I can guard that rather than include an implementation (if you prefer).