Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions includes/pthread.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#ifndef GOBLINT_NO_PTHREAD_ONCE
#include <pthread.h>

int pthread_once(pthread_once_t *once_control,void (*init_routine)(void)) __attribute__((goblint_stub));
Expand All @@ -7,3 +8,4 @@ int pthread_once(pthread_once_t *once_control,void (*init_routine)(void)) {
init_routine();
return top;
}
#endif
7 changes: 6 additions & 1 deletion includes/stdlib.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#if !defined(GOBLINT_NO_QSORT) || !defined(GOBLINT_NO_BSEARCH)
#include <stddef.h>
#endif

#ifndef GOBLINT_NO_QSORT
void qsort(void *ptr, size_t count, size_t size, int (*comp)(const void*, const void*)) __attribute__((goblint_stub));
void qsort(void *ptr, size_t count, size_t size, int (*comp)(const void*, const void*)) {
// call all possible compares first, before invalidating array elements
Expand Down Expand Up @@ -28,8 +31,9 @@ void qsort(void *ptr, size_t count, size_t size, int (*comp)(const void*, const

// array isn't actually sorted! just pretend calls for Goblint
}
#endif


#ifndef GOBLINT_NO_BSEARCH
void* bsearch(const void *key, const void *ptr, size_t count, size_t size, int (*comp)(const void*, const void*)) __attribute__((goblint_stub));
void* bsearch(const void *key, const void *ptr, size_t count, size_t size, int (*comp)(const void*, const void*)) {
// linear search for simplicity
Expand All @@ -42,3 +46,4 @@ void* bsearch(const void *key, const void *ptr, size_t count, size_t size, int (

return NULL;
}
#endif
10 changes: 10 additions & 0 deletions tests/regression/41-stdlib/03-noqsort.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// PARAM: --set cppflags[+] -DGOBLINT_NO_QSORT
#include<stddef.h>

// There should be no CIL warning about multiple definitions here
void qsort(void *ptr, size_t count, size_t size, int (*comp)(const void*, const void*), int more) {
}

int main() {

}