Permalink
Browse files

Quiet pthread_yield() warnings.

Hopefully, this works out fine on various platforms. With it, clang
3.5 now builds warning-free.
  • Loading branch information...
jnthn committed Jan 17, 2015
1 parent 686058b commit 0194409f7599850d73b8861cd26d2fe9b9f7f85b
Showing with 1 addition and 0 deletions.
  1. +1 −0 src/platform/threads.h
View
@@ -4,6 +4,7 @@
#include <sched.h>
#define MVM_platform_thread_yield sched_yield
#else
int pthread_yield(void); /* As including pthread.h seems not enough... */
#define MVM_platform_thread_yield pthread_yield
#endif

1 comment on commit 0194409

@usev6

This comment has been minimized.

Show comment
Hide comment
@usev6

usev6 Jan 18, 2015

Contributor

Sadly, this seems to break my build on FreeBSD 10.1. When I remove the added line, I can build Rakudo again (with "perl Configure.pl --gen-moar --gen-nqp --backends=moar && make")

The actual error is:

[...]
compiling src/core/threads.o
In file included from src/core/threads.c:2:
src/platform/threads.h:7:5: error: conflicting types for 'pthread_yield'
int pthread_yield(void); /* As including pthread.h seems not enough... */
    ^
/usr/include/pthread.h:261:7: note: previous declaration is here
void            pthread_yield(void);
                ^
1 error generated.
*** Error code 1

Stop.
make: stopped in /usr/home/christian/perl6-roast-data/rakudo.moar/nqp/MoarVM

The relevant part of /usr/include/pthread.h is (line numbers included):

    258 #if __BSD_VISIBLE
    259 int             pthread_getprio(pthread_t);
    260 int             pthread_setprio(pthread_t, int);
    261 void            pthread_yield(void);
    262 #endif
$ cd nqp/MoarVM
$ perl Configure.pl
[...]
        make: make
     compile: clang -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -DNDEBUG  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -fPIC
        link: clang  -O1 -DNDEBUG -Wl,-rpath,@libdir@
        libs: -lm -lpthread -lkvm

  byte order: little endian
[...]
$ $ clang --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix

If you need more information, I'll happily provide it.

Or should I better open an issue for this?

Contributor

usev6 commented on 0194409 Jan 18, 2015

Sadly, this seems to break my build on FreeBSD 10.1. When I remove the added line, I can build Rakudo again (with "perl Configure.pl --gen-moar --gen-nqp --backends=moar && make")

The actual error is:

[...]
compiling src/core/threads.o
In file included from src/core/threads.c:2:
src/platform/threads.h:7:5: error: conflicting types for 'pthread_yield'
int pthread_yield(void); /* As including pthread.h seems not enough... */
    ^
/usr/include/pthread.h:261:7: note: previous declaration is here
void            pthread_yield(void);
                ^
1 error generated.
*** Error code 1

Stop.
make: stopped in /usr/home/christian/perl6-roast-data/rakudo.moar/nqp/MoarVM

The relevant part of /usr/include/pthread.h is (line numbers included):

    258 #if __BSD_VISIBLE
    259 int             pthread_getprio(pthread_t);
    260 int             pthread_setprio(pthread_t, int);
    261 void            pthread_yield(void);
    262 #endif
$ cd nqp/MoarVM
$ perl Configure.pl
[...]
        make: make
     compile: clang -fno-omit-frame-pointer -fno-optimize-sibling-calls -O1 -DNDEBUG  -D_REENTRANT -D_FILE_OFFSET_BITS=64 -fPIC
        link: clang  -O1 -DNDEBUG -Wl,-rpath,@libdir@
        libs: -lm -lpthread -lkvm

  byte order: little endian
[...]
$ $ clang --version
FreeBSD clang version 3.4.1 (tags/RELEASE_34/dot1-final 208032) 20140512
Target: x86_64-unknown-freebsd10.1
Thread model: posix

If you need more information, I'll happily provide it.

Or should I better open an issue for this?

Please sign in to comment.