public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: bz0815@tirol.com
To: cygwin@cygwin.com
Subject: Pthreads: Prototypes missing if -std=c11 
Date: Wed, 12 Jul 2017 16:16:00 -0000	[thread overview]
Message-ID: <mtranet.20170712181557.1862059698@a1.net> (raw)

Hello,

gcc does not recognize some functions from pthread.h if option -std=c11 is used:

#include <pthread.h>
#define THREADS 5

int main (int argc, char *argv[])
{
  pthread_barrier_t barrier;
  pthread_barrier_init(&barrier, NULL, THREADS);
}

gcc -std=c11 -o test test.c
test.c: In function ‘main’:
test.c:8:3: warning: implicit declaration of function ‘pthread_barrier_init’ [-Wimplicit-function-declaration]
   pthread_barrier_init(&barrier, NULL, THREADS);
   ^

There is no warning without that option:

gcc -o test test.c

My system is:

$ uname -a
CYGWIN_NT-10.0 DESKTOP 2.8.1(0.312/5/3) 2017-07-03 14:11 x86_64 Cygwin

The compiler used is:

$ gcc --version
gcc (GCC) 5.4.0
Copyright (C) 2015 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

It seems to be a __POSIX_VISIBLE issue.

Thanks


--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

             reply	other threads:[~2017-07-12 16:16 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-12 16:16 bz0815 [this message]
2017-07-12 17:50 ` Yaakov Selkowitz
2017-07-13 15:36 bz0815
2017-07-13 17:38 ` cyg Simple
2017-07-13 19:30 ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=mtranet.20170712181557.1862059698@a1.net \
    --to=bz0815@tirol.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).