From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 70628 invoked by alias); 29 Nov 2018 02:22:50 -0000 Mailing-List: contact cygwin-help@cygwin.com; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner@cygwin.com Mail-Followup-To: cygwin@cygwin.com Received: (qmail 70597 invoked by uid 89); 29 Nov 2018 02:22:48 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=BAYES_00,KAM_LAZY_DOMAIN_SECURITY autolearn=no version=3.3.2 spammy=Debian, H*M:help, H*MI:help, H*r:Debian-8 X-HELO: mars.tony.develop-help.com Received: from develop-help.com (HELO mars.tony.develop-help.com) (14.200.49.10) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Thu, 29 Nov 2018 02:22:46 +0000 Received: from mars.tony.develop-help.com (localhost [127.0.0.1]) by mars.tony.develop-help.com (8.15.2/8.15.2/Debian-8) with ESMTP id wAT2MhWt032396 for ; Thu, 29 Nov 2018 13:22:43 +1100 Received: (from tony@localhost) by mars.tony.develop-help.com (8.15.2/8.15.2/Submit) id wAT2MgAp032395 for cygwin@cygwin.com; Thu, 29 Nov 2018 13:22:42 +1100 Date: Thu, 29 Nov 2018 02:22:00 -0000 From: Tony Cook To: cygwin@cygwin.com Subject: _GNU_SOURCE doesn't enable cuserid() declaration Message-ID: <20181129022242.3llewsc7gottm6yv@mars.tony.develop-help.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit User-Agent: NeoMutt/20170113 (1.7.2) X-IsSubscribed: yes X-SW-Source: 2018-11/txt/msg00230.txt.bz2 Linux stdio.h exposes the declaration of cuserid() both with standard version macros and with _GNU_SOURCE: tony@mars:~/play$ cat testcuserid.c #define _GNU_SOURCE #include int main() { puts(cuserid(NULL)); return 0; } tony@mars:~/play$ gcc -otestcuserid -Werror=all testcuserid.c tony@mars:~/play$ ./testcuserid tony tony@mars:~/play$ uname -a Linux mars 4.9.0-8-amd64 #1 SMP Debian 4.9.110-3+deb9u4 (2018-08-21) x86_64 GNU/Linux while on Cygwin _GNU_SOURCE doesn't expose cuserid(): tony@phobos /cygdrive/n/play $ gcc -otestcuserid.exe -Werror=all testcuserid.c testcuserid.c: In function ‘main’: testcuserid.c:5:8: error: implicit declaration of function ‘cuserid’; did you mean ‘L_cuserid’? [-Werror=implicit-function-declaration] puts(cuserid(NULL)); ^~~~~~~ L_cuserid testcuserid.c:5:8: warning: passing argument 1 of ‘puts’ makes pointer from integer without a cast [-Wint-conversion] In file included from testcuserid.c:2:0: /usr/include/stdio.h:221:5: note: expected ‘const char *’ but argument is of type ‘int’ int puts (const char *); ^~~~ cc1: some warnings being treated as errors tony@phobos /cygdrive/n/play $ uname -a CYGWIN_NT-6.1 phobos 2.11.2(0.329/5/3) 2018-11-08 14:34 x86_64 Cygwin This seems unintentional, since L_cuserid is exposed with _GNU_SOURCE on Cygwin: tony@phobos /cygdrive/n/play $ cat testlcuserid.c #define _GNU_SOURCE #include int main() { printf("%d\n", (int)L_cuserid); return 0; } tony@phobos /cygdrive/n/play $ gcc -otestlcuserid.exe -Werror=all testlcuserid.c and on Linux: tony@mars:~/play$ gcc -otestlcuserid -Werror=all testlcuserid.c (neither produces a diagnostic) Tony -- 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