summaryrefslogtreecommitdiffhomepage
path: root/misc
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
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')
-rwxr-xr-xmisc/examples/make.sh12
-rw-r--r--misc/tests/ctest.h12
2 files changed, 14 insertions, 10 deletions
diff --git a/misc/examples/make.sh b/misc/examples/make.sh
index 0c4760a6..19a53880 100755
--- a/misc/examples/make.sh
+++ b/misc/examples/make.sh
@@ -6,14 +6,14 @@ if [ "$(uname)" = 'Linux' ]; then
oflag='-o '
fi
+cc=gcc; cflags="-s -O2 -std=c99 -Wconversion -Wpedantic -Wall -Wsign-compare -Wwrite-strings"
#cc=gcc; cflags="-s -O2 -std=c99 -Werror -Wfatal-errors -Wpedantic -Wall $sanitize"
-cc=gcc; cflags="-s -O2 -std=c99 -Wconversion -Wpedantic -Wall -Wsign-compare -Wwrite-strings" # -Wconversion
#cc=tcc; cflags="-Wall -std=c99"
#cc=clang; cflags="-s -O2 -std=c99 -Werror -Wfatal-errors -Wpedantic -Wall -Wsign-compare -Wwrite-strings"
#cc=clang; cflags="-s -O2 -std=c99 -Werror -Wfatal-errors -Wpedantic -Wall -DSTC_CSTR_V1 -DSTC_CSMAP_V1"
#cc=gcc; cflags="-x c++ -s -O2 -Wall -std=c++20"
#cc=g++; cflags="-x c++ -s -O2 -Wall"
-#cc=cl; cflags="-O2 -nologo -W2 -MD"
+#cc=cl; cflags="-O2 -nologo -W3 -MD"
#cc=cl; cflags="-nologo -TP"
#cc=cl; cflags="-nologo -std:c11"
@@ -40,13 +40,13 @@ fi
if [ $run = 0 ] ; then
for i in *.c ; do
- echo $comp -I../include $i $clibs $oflag$(basename $i .c).exe
- $comp -I../include $i $clibs $oflag$(basename $i .c).exe
+ echo $comp -I../../include $i $clibs $oflag$(basename $i .c).exe
+ $comp -I../../include $i $clibs $oflag$(basename $i .c).exe
done
else
for i in *.c ; do
- echo $comp -I../include $i $clibs
- $comp -I../include $i $clibs
+ echo $comp -I../../include $i $clibs
+ $comp -I../../include $i $clibs
if [ -f $(basename -s .c $i).exe ]; then ./$(basename -s .c $i).exe; fi
if [ -f ./a.exe ]; then ./a.exe; fi
if [ -f ./a.out ]; then ./a.out; fi
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;