summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh10
-rw-r--r--tests/.gitignore2
-rw-r--r--tests/test.c19
3 files changed, 23 insertions, 8 deletions
diff --git a/build.sh b/build.sh
index 6e1628c..7cdf20c 100755
--- a/build.sh
+++ b/build.sh
@@ -8,15 +8,17 @@ if [ "$CC" = "" ]; then
fi
if uname | grep -qi bsd; then
- CFLAGS="$CFLAGS -L/usr/local/lib -I/usr/local/include"
+ CFLAGS="$CFLAGS -L/usr/local/lib -I/usr/local/include -std=gnu99 -w"
+else
+ CFLAGS="$CFLAGS -Wpedantic -std=c11"
fi
ADDITIONAL_FLAGS="$CFLAGS -Wno-unused-function"
if [ "$CC" = "clang" ]; then
- WARNINGS='-Wall -Wextra -Wpedantic -Wshadow -Wconversion -Wimplicit-fallthrough -Wno-missing-braces'
+ WARNINGS='-Wall -Wextra -Wshadow -Wconversion -Wimplicit-fallthrough -Wno-missing-braces'
elif [ "$CC" = "gcc" ]; then
- WARNINGS='-Wall -Wextra -Wpedantic -Wshadow -Wconversion'
+ WARNINGS='-Wall -Wextra -Wshadow -Wconversion'
elif [ "$CC" = "tcc" ]; then
WARNINGS='-Wall'
elif [ "$CC" = "g++" ]; then
@@ -35,7 +37,7 @@ if [ "$COMPILE_TIME_FOREIGN_FN_SUPPORT" != "no" ]; then
fi
-DEBUG_FLAGS="-O0 $WARNINGS -std=c11 -DTOC_DEBUG"
+DEBUG_FLAGS="-O0 $WARNINGS -DTOC_DEBUG"
if [ "$CC" = "gcc" ]; then
DEBUG_FLAGS="$DEBUG_FLAGS -no-pie -gdwarf-2 -pipe"
elif [ "$CC" = "clang" ]; then
diff --git a/tests/.gitignore b/tests/.gitignore
index 4b9aca5..33ccc5b 100644
--- a/tests/.gitignore
+++ b/tests/.gitignore
@@ -1,4 +1,6 @@
got
out.c
+a.out
*.exe
test
+*.core
diff --git a/tests/test.c b/tests/test.c
index 1da262b..0593c9d 100644
--- a/tests/test.c
+++ b/tests/test.c
@@ -14,7 +14,9 @@ static const char *tests[] = {
"arrs_slices",
"ptr_arithmetic",
"defer",
- "sizeof",
+#ifndef __OpenBSD__
+ "sizeof", /* OpenBSD's GCC doesn't support _Alignof */
+#endif
"new",
"arr",
"arr2",
@@ -42,9 +44,12 @@ static const char *compilers[] = {
};
#else
static const char *compilers[] = {
- "gcc -O0 -g -Wno-parentheses-equality -Wno-builtin-declaration-mismatch",
- "clang -O3 -s -Wno-parentheses-equality -Wno-builtin-requires-header -Wno-format-security",
+ "gcc -O0 -g -Wno-parentheses-equality -Wno-builtin-declaration-mismatch -std=c99",
+ "clang -O3 -s -Wno-parentheses-equality -Wno-builtin-requires-header -Wno-format-security -std=c99"
+#ifdef __linux__ /* couldn't get TCC to build on BSD */
+ ,
"tcc"
+#endif
};
#endif
#define ncompilers ((int)(sizeof compilers / sizeof *compilers))
@@ -61,8 +66,12 @@ int main(int argc, char **argv) {
int i, c;
char command[256];
int color = 0;
+ int valgrind = 0;
#if unix
color = isatty(1);
+ #ifdef __linux__ /* valgrind is complaining a lot on BSD, but i think it's wrong */
+ valgrind = 1;
+ #endif
#endif
char const *failed;
if (color) {
@@ -76,8 +85,10 @@ int main(int argc, char **argv) {
fflush(stdout);
if (windows) {
sprintf(command, "..\\toc %s.toc", test);
+ } else if (valgrind) {
+ sprintf(command, "valgrind -q --error-exitcode=1 ../toc %s.toc", test);
} else {
- sprintf(command, "valgrind -q --exit-on-first-error=yes --error-exitcode=1 ../toc %s.toc", test);
+ sprintf(command, "../toc %s.toc", test);
}
if (system(command)) {
fprintf(stderr, "%s (while compiling toc).\n", failed);