summaryrefslogtreecommitdiffhomepage
path: root/misc/tests
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2023-02-04 23:24:54 +0100
committerTyge Løvset <[email protected]>2023-02-04 23:24:54 +0100
commitd2ff84c53aa9bd3857fdf22dcf7cd9398a4780be (patch)
tree4923f88afb0d091d5d39ae03d65a4998a0517652 /misc/tests
parent626b893b4d9e048c27571bfa28352914f2cd2bbc (diff)
downloadSTC-modified-d2ff84c53aa9bd3857fdf22dcf7cd9398a4780be.tar.gz
STC-modified-d2ff84c53aa9bd3857fdf22dcf7cd9398a4780be.zip
Fix in ccommon.h to make MSVC work again (without -std:c11) + small adjustments.
Diffstat (limited to 'misc/tests')
-rw-r--r--misc/tests/ctest.h12
1 files changed, 8 insertions, 4 deletions
diff --git a/misc/tests/ctest.h b/misc/tests/ctest.h
index 4d42216c..373cda0e 100644
--- a/misc/tests/ctest.h
+++ b/misc/tests/ctest.h
@@ -93,8 +93,10 @@ struct ctest {
#ifdef __APPLE__
#define CTEST_IMPL_SECTION __attribute__ ((used, section ("__DATA, .ctest"), aligned(1)))
-#else
+#elif !defined _MSC_VER
#define CTEST_IMPL_SECTION __attribute__ ((used, section (".ctest"), aligned(1)))
+#else
+#define CTEST_IMPL_SECTION
#endif
#define CTEST_IMPL_STRUCT(sname, tname, tskip, tdata, tsetup, tteardown) \
@@ -445,7 +447,7 @@ static void sighandler(int signum)
const char msg_nocolor[] = "[SIGSEGV: Segmentation fault]\n";
const char* msg = color_output ? msg_color : msg_nocolor;
- intptr_t n = write(STDOUT_FILENO, msg, (unsigned int)strlen(msg));
+ intptr_t n = write(1, msg, (unsigned int)strlen(msg));
(void)n;
/* "Unregister" the signal handler and send the signal back to the process
* so it can terminate as expected */
@@ -457,8 +459,10 @@ static void sighandler(int signum)
#endif
int ctest_main(int argc, const char *argv[]);
-
-__attribute__((no_sanitize_address)) int ctest_main(int argc, const char *argv[])
+#ifdef __GNUC__
+__attribute__((no_sanitize_address))
+#endif
+int ctest_main(int argc, const char *argv[])
{
static int total = 0;
static int num_ok = 0;