delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2025/10/23/23:29:30

DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 59O3TTZo2677757
Authentication-Results: delorie.com; dmarc=pass (p=none dis=none) header.from=cygwin.com
Authentication-Results: delorie.com; spf=pass smtp.mailfrom=cygwin.com
DKIM-Filter: OpenDKIM Filter v2.11.0 delorie.com 59O3TTZo2677757
Authentication-Results: delorie.com;
dkim=pass (1024-bit key, unprotected) header.d=cygwin.com header.i=@cygwin.com header.a=rsa-sha256 header.s=default header.b=ShYmsr3W
X-Recipient: archive-cygwin AT delorie DOT com
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1EE81385801D
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com;
s=default; t=1761276568;
bh=mQk+tdXgAS0HbuaFt3yE6q6rxY5viGxnqOt1GE88Jlc=;
h=Date:Subject:To:Cc:List-Id:List-Unsubscribe:List-Archive:
List-Post:List-Help:List-Subscribe:From:Reply-To:From;
b=ShYmsr3WPVO8d35SDfJ8nn19olb5i4iUjYmRcSZt7ySt+HRPzq7TpfgJeiybgAn33
PqMS5OCF96wgsu8kBSK1rwLfzH+IfCFeTiOucD3Pk903rRQ2QGYB8ETvk+Nl0dXCuA
U7GH3CT3Jszf0PF9xzppMvbPN0y4BvRAI7Ef7/DE=
X-Original-To: cygwin AT cygwin DOT com
Delivered-To: cygwin AT cygwin DOT com
DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org CB4A93858D3C
ARC-Filter: OpenARC Filter v1.0.0 sourceware.org CB4A93858D3C
ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1761276542; cv=none;
b=fNGpodJNiYMgWOC43QxZ5m15WM2Si+heWOraVEuD/CtzMKe8io/mwxmdZCYT6q5JMo4RGyO0hm3AmRPm1od2GhVZLiMVod/UOCahN9gXN6Orlt9WUhSuFqjAnF/XA1pzOJGvCmbwHindJfMVqrXpWdgkI36d5+Rmb5kcP9DaQWg=
ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key;
t=1761276542; c=relaxed/simple;
bh=zAwxNOspq0xNGxAVUxDuGuQmgFPNlJES4vpUVXsf2kU=;
h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To;
b=p5+JPaBcxxA+ZzVwridrTmEnOrAK2zbSkl4d5OhaaUbuMtKNr7fNuuRD6eu6MHCDzkreq5Wf87s1t+539ghJdximwC9DUZvhkxCKvr6Vh1prJi5HSJvHoUxMRcD7yhNGRi6FzkH2AU7Pqx+3tZvYCobkiImx3a1ZXeiMHDbggUk=
ARC-Authentication-Results: i=1; server2.sourceware.org
DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org CB4A93858D3C
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
d=1e100.net; s=20230601; t=1761276540; x=1761881340;
h=cc:to:subject:message-id:date:from:mime-version:x-gm-message-state
:from:to:cc:subject:date:message-id:reply-to;
bh=wnPv8W1p6T72trW3jzZ/r5dkHDIVG9uVK4VHqP1zqIc=;
b=qwHGdNcGLGq66uoLqnqFt6rQjPAgLQFBk8hGGtUVoLzOfzIVTJDelnatk540xUqrmR
thpOHoLI3swqM6cTOvKTUPwS3f26kym2zDsTAcMTgYsvcHRlkm6De3/wyn9NqxDHWAji
zIdG6O10z0k1yaRU7jVudcKlOMOR1YqnwyJti8gfW0PRG8mopfKNAWX2vzMaHvpFguND
rXi/XV+UwA4b2X6f/lruhTvu6YapLmphG1w+qCAn43J5yatTWdaUpY5PDKom2XSc0nK1
d5momJ9h3GuNCcDDvhm1BEn4LTBmkkYqAs5FUIBd4GaSry2/chQG5IQDQ0HKApLvMF9N
xYTg==
X-Gm-Message-State: AOJu0Yygwjd+StZL70lWdpeqd+bM7SUKat2gEPJHiHGJQQ/gp6jPOajf
TQJM/ARY2VtTfhURraeS+WfkPMLapZFR3fHWUR9rdKFBsxp+Ecqlfh2rRMMA9XxVIq1rPw3Y/BX
D1FM3ufI67cmtEh6knzhoKkcxLp06LackmpHp
X-Gm-Gg: ASbGnctNfYuYsCTGXQLSoPCDHHBISyq2aiv1w1UtDdRkurLH4mCkeHEMC74iSgYM4Hl
G/4MFpjx59/SS1+/Qente/PaMEgT45EAREU3KYBoXzfBWlfFvycutmLvnbOdNDKY8iO2NUSK4AC
XsFFKiApxlg7dBFHgUOCg197mxY7YjRlh7YqfM5ueYFLlwObj8zIWP9xk1RWP6u8GkHwxclTW/5
ECNv4x0ffSNv3BM7ifEmnswb4VoqiZyZOhrHSM8t8XfVB8i2Tq0QslRNr0izBI3rmXKvAI=
X-Google-Smtp-Source: AGHT+IFdc9jTiDXf/hgWzPCa5OAGbCOnAyXOhrjXLM4/KNKHC9io+8qU7va5f1nOE0U9ltTDzuVnCba0znT8eAmI9RM=
X-Received: by 2002:a5d:5d86:0:b0:427:526:16a3 with SMTP id
ffacd0b85a97d-4299072c146mr425790f8f.29.1761276539574; Thu, 23 Oct 2025
20:28:59 -0700 (PDT)
MIME-Version: 1.0
Date: Thu, 23 Oct 2025 20:28:48 -0700
X-Gm-Features: AWmQ_bnk2NX7s3Gstn7ve7nv96S6y9efS790chSQa4l5D1wum82rOMYItgASUe4
Message-ID: <CAAHpriMb2CG9Tfv6S9ADc84-dwe1n2i+rxqoKDS_0Lwcdamghg@mail.gmail.com>
Subject: gcc/newlib bug: getline() should not be visible in conforming mode
To: The Cygwin Mailing List <cygwin AT cygwin DOT com>
Cc: Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com>
X-Content-Filtered-By: Mailman/MimeDel 2.1.30
X-BeenThere: cygwin AT cygwin DOT com
X-Mailman-Version: 2.1.30
List-Id: General Cygwin discussions and problem reports <cygwin.cygwin.com>
List-Archive: <https://cygwin.com/pipermail/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-request AT cygwin DOT com?subject=help>
List-Subscribe: <https://cygwin.com/mailman/listinfo/cygwin>,
<mailto:cygwin-request AT cygwin DOT com?subject=subscribe>
From: Keith Thompson via Cygwin <cygwin AT cygwin DOT com>
Reply-To: Keith Thompson <Keith DOT S DOT Thompson AT gmail DOT com>
Sender: "Cygwin" <cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com>
X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 59O3TTZo2677757

The "getline" function is specified by POSIX to be declared
in <stdio.h>.  It is not specified by the ISO C standard, so the
identifier should be available for use in strictly conforming
programs.

$ cat getline_bug.c
#include <stdio.h>
int getline = 0;
int main(void) {
    return getline;
}
$ gcc --version
gcc (GCC) 16.0.0 20250907 (experimental)
Copyright (C) 2025 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.

$ gcc getline_bug.c -o getline_bug
getline_bug.c:2:5: error: ‘getline’ redeclared as different kind of symbol
    2 | int getline = 0;
      |     ^~~~~~~
In file included from /usr/include/stdio.h:85,
                 from getline_bug.c:1:
/usr/include/sys/stdio.h:35:9: note: previous declaration of ‘getline’ with
type ‘ssize_t(char **, size_t *, FILE *)’ {aka ‘long int(char **, long
unsigned int *, FILE *)’}
   35 | ssize_t getline (char **, size_t *, FILE *);
      |         ^~~~~~~

$

Stack Overflow user "pmor" reports the same problem with gcc 12.4.0.

The problem is in newlib, winsup/cygwin/include/sys/stdio.h, line 35.
I expect getdelim() to exhibit the same problem, but I haven't checked that.

GNU libc's <stdio.h> avoids this problem by surrounding the
declarations of getline() and getdelim() by an appropriate #ifdef.

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

- Raw text -


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