about summary refs log tree commit diff homepage
path: root/test/Runtime
diff options
context:
space:
mode:
authorMartin Nowack <m.nowack@imperial.ac.uk>2023-10-30 11:59:29 +0000
committerCristian Cadar <c.cadar@imperial.ac.uk>2024-02-08 13:17:19 +0000
commitf9cb81fa27ca6ae4fef1c22081040071d20e4413 (patch)
treecae0000d0087ad36d51e554c20d684433089c8e9 /test/Runtime
parent5371eb8474cc4dced751d0515c1ea9499d009668 (diff)
downloadklee-f9cb81fa27ca6ae4fef1c22081040071d20e4413.tar.gz
Assume C compiler's default standard is `-std=gnu17`
Newer compilers use `-std=gnu17` as the default when compiling C code.
Fix all the test cases that violate this behaviour or explicitly request
older standards `-std=c89` where necessary.
Diffstat (limited to 'test/Runtime')
-rw-r--r--test/Runtime/POSIX/FDNumbers.c4
-rw-r--r--test/Runtime/POSIX/Fcntl.c2
-rw-r--r--test/Runtime/POSIX/FreeArgv.c3
-rw-r--r--test/Runtime/POSIX/Getenv.c5
-rw-r--r--test/Runtime/POSIX/Openat.c3
-rw-r--r--test/Runtime/POSIX/Replay.c1
-rw-r--r--test/Runtime/POSIX/Stdin.c7
-rw-r--r--test/Runtime/POSIX/Write1.c4
-rw-r--r--test/Runtime/POSIX/Write2.c4
-rw-r--r--test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c1
10 files changed, 21 insertions, 13 deletions
diff --git a/test/Runtime/POSIX/FDNumbers.c b/test/Runtime/POSIX/FDNumbers.c
index 42f0f5ae..4e0fa79a 100644
--- a/test/Runtime/POSIX/FDNumbers.c
+++ b/test/Runtime/POSIX/FDNumbers.c
@@ -1,10 +1,10 @@
 // RUN: %clang %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
-
 #include <assert.h>
-#include <fcntl.h>
 #include <errno.h>
+#include <fcntl.h>
+#include <unistd.h>
 
 int main(int argc, char **argv) {
   int fd = open("A", O_TRUNC);
diff --git a/test/Runtime/POSIX/Fcntl.c b/test/Runtime/POSIX/Fcntl.c
index 53246a15..737d5da5 100644
--- a/test/Runtime/POSIX/Fcntl.c
+++ b/test/Runtime/POSIX/Fcntl.c
@@ -1,7 +1,7 @@
 // RUN: %clang %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
-
+#include "klee/klee.h"
 #include <assert.h>
 #include <fcntl.h>
 
diff --git a/test/Runtime/POSIX/FreeArgv.c b/test/Runtime/POSIX/FreeArgv.c
index 93ed697e..cdc5487f 100644
--- a/test/Runtime/POSIX/FreeArgv.c
+++ b/test/Runtime/POSIX/FreeArgv.c
@@ -4,7 +4,8 @@
 // RUN: test -f %t.klee-out/test000001.free.err
 // RUN: test -f %t.klee-out/test000002.free.err
 // RUN: test -f %t.klee-out/test000003.free.err
-
+#include "klee/klee.h"
+#include <stdlib.h>
 int main(int argc, char **argv) {
   switch (klee_range(0, 3, "range")) {
   case 0:
diff --git a/test/Runtime/POSIX/Getenv.c b/test/Runtime/POSIX/Getenv.c
index 6dff3c24..d5db7c39 100644
--- a/test/Runtime/POSIX/Getenv.c
+++ b/test/Runtime/POSIX/Getenv.c
@@ -1,9 +1,10 @@
 // RUN: %clang %s -emit-llvm %O0opt -c -o %t2.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --libc=klee --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
-
 #include <assert.h>
-
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
 int main(int argc, char **argv) {
   char *g = getenv("PWD");
   if (g) {
diff --git a/test/Runtime/POSIX/Openat.c b/test/Runtime/POSIX/Openat.c
index 2341527e..67ff78bd 100644
--- a/test/Runtime/POSIX/Openat.c
+++ b/test/Runtime/POSIX/Openat.c
@@ -2,9 +2,10 @@
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --posix-runtime --exit-on-error %t2.bc --sym-files 1 10
 // RUN: test -f %t.klee-out/test000001.ktest
-
+#include "klee/klee.h"
 #include <assert.h>
 #include <fcntl.h>
+#include <unistd.h>
 
 int main(int argc, char **argv) {
   int fd = openat(AT_FDCWD, "A", O_RDWR|O_TRUNC);
diff --git a/test/Runtime/POSIX/Replay.c b/test/Runtime/POSIX/Replay.c
index 61862c5f..fb1b400c 100644
--- a/test/Runtime/POSIX/Replay.c
+++ b/test/Runtime/POSIX/Replay.c
@@ -8,6 +8,7 @@
 // REPLAY: Yes
 
 #ifdef KLEE_EXECUTION
+#include "klee/klee.h"
 #define EXIT klee_silent_exit
 #else
 #include <stdlib.h>
diff --git a/test/Runtime/POSIX/Stdin.c b/test/Runtime/POSIX/Stdin.c
index 6d84baff..84caab3a 100644
--- a/test/Runtime/POSIX/Stdin.c
+++ b/test/Runtime/POSIX/Stdin.c
@@ -9,11 +9,12 @@
 // RUN: grep "mode:lnk" %t.log
 // RUN: grep "read:sym:yes" %t.log
 // RUN: grep "read:sym:no" %t.log
-
-#include <stdio.h>
+#include <assert.h>
 #include <fcntl.h>
+#include <stdio.h>
+#include <string.h>
 #include <sys/stat.h>
-#include <assert.h>
+#include <unistd.h>
 
 int main(int argc, char **argv) {
   struct stat stats;
diff --git a/test/Runtime/POSIX/Write1.c b/test/Runtime/POSIX/Write1.c
index 5fc4ff8f..7f1e6f20 100644
--- a/test/Runtime/POSIX/Write1.c
+++ b/test/Runtime/POSIX/Write1.c
@@ -2,8 +2,10 @@
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
 
-#include <stdio.h>
+#include "klee/klee.h"
 #include <assert.h>
+#include <stdio.h>
+#include <string.h>
 
 int main(int argc, char** argv) {
   char buf[32];
diff --git a/test/Runtime/POSIX/Write2.c b/test/Runtime/POSIX/Write2.c
index 04698f21..e9eb6f6b 100644
--- a/test/Runtime/POSIX/Write2.c
+++ b/test/Runtime/POSIX/Write2.c
@@ -1,9 +1,9 @@
 // RUN: %clang %s -emit-llvm %O0opt -c -o %t.bc
 // RUN: rm -rf %t.klee-out
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc --posix-runtime %t.bc --sym-files 1 10 --sym-stdout 2>%t.log
-
-#include <stdio.h>
+#include "klee/klee.h"
 #include <assert.h>
+#include <stdio.h>
 
 int main(int argc, char** argv) {
   const char* msg = "This will eventually overflow stdout. ";
diff --git a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
index 3b66dd21..26bb1dce 100644
--- a/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
+++ b/test/Runtime/Uclibc/2008-03-04-libc-atexit-uses-dso-handle.c
@@ -3,6 +3,7 @@
 // RUN: %klee --output-dir=%t.klee-out --exit-on-error --libc=uclibc %t1.bc
 
 // just make sure atexit works ok
+#include <stdlib.h>
 
 void boo() {
 }