delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2017/07/12/12:16:17

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:mime-version
:content-type:content-id:content-transfer-encoding; q=dns; s=
default; b=KbfufYMaO5X3ypJ3ItGdnByB9jPm9Aw85+zjvW94RS6/Q3ZWTkaGn
5S3OjkFwUWz/9hnahUTfQYARayMEurddDFZ93ctYqjMLSD84Oli3/bXDbMqXSICP
1Cg8wh3ZJRC57pt5zLUOv3fovs/KKMed0rtnqSb5XOmW4Wfqt7NYeE=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:date:from:to:subject:message-id:mime-version
:content-type:content-id:content-transfer-encoding; s=default;
bh=EXt8uj/4RB7B0GD57SN3ezMNvTw=; b=uftkXOjRNhaxN4/ArpxBAfaQV4Ra
TT3cv8e2ZcYclGGFW+tQUFvaJvdBvOD8Osf92sTCTMaKowUz/tIO2pdUIcpAaNKx
h9SsiaVZ5LxABycLXfz1HX3uh74FlLoa0hbi/nDgvljTwpjCtvWa0wIcCp3hryDn
YohZ+senrJQEslA=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_LOW autolearn=no version=3.3.2 spammy=H*r:qmail-ldap-1.03, H*r:envelope-sender
X-HELO: smtpout.aon.at
X-A1Mail-Track-Id: 1499876157:2220:smarthub80:213.33.87.6:1
Date: Wed, 12 Jul 2017 18:15:57 +0200 (CEST)
From: bz0815 AT tirol DOT com
To: cygwin AT cygwin DOT com
X-Auth-ID: aon.965001387.neff
Subject: =?utf-8?Q?Pthreads=3A_Prototypes_missing_if_-std=3Dc11_?=
Message-ID: <mtranet.20170712181557.1862059698@a1.net>
MIME-Version: 1.0
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id v6CGGGMJ007935

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


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019