DMARC-Filter: OpenDMARC Filter v1.4.2 delorie.com 61FA0UK41295928 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 61FA0UK41295928 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=acxMocuF X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1ADEB4BAD149 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1771149629; bh=r6VJhy99fp2+1s/R5LwMcW7cxxkw3ytQqdUkQaVmU64=; h=Date:To:Subject:References:In-Reply-To:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=acxMocuFcLmY1Rj3c7MB6DAtzYJtxbhLIFIHB6lp3Slmk0X8rdB0spFFgFK8G9Glg wzl5ou8pToX2xHpljrRKyLDjbO7urIz00ltx1SOIAzPnuL835CcKazRpPPk+QLeQMK /m2duQiBu3cdQ1UqzoeBgJi9RATY7bSKgSSgtOcI= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 0AEA54B9DB6F Date: Sun, 15 Feb 2026 10:59:42 +0100 To: cygwin AT cygwin DOT com Subject: Re: BUG: "machine/types.h" not protected by multiple #include Message-ID: Mail-Followup-To: cygwin AT cygwin DOT com References: MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.30 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Corinna Vinschen via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Corinna Vinschen Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces~archive-cygwin=delorie DOT com AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 61FA0UK41295928 On Feb 14 20:41, Carlo B. via Cygwin wrote: > Hello, > while compiling libsrtp2, I got this error: > > /usr/include/machine/types.h:35:8: error: redefinition of ‘struct flock’ > 35 | struct flock { > | ^~~~~ > In file included from /usr/include/sys/types.h:222, > from > ../gstreamer/subprojects/libsrtp-2.7.0/crypto/include/integers.h:60: > /usr/include/machine/types.h:35:8: note: originally defined here > 35 | struct flock { > | ^~~~~ > > This happens because into the library there is this code: > > <--- CUT ---> > #ifdef HAVE_SYS_TYPES_H > #include > #endif > #ifdef HAVE_MACHINE_TYPES_H > #include > #endif > <--- CUT ---> > > The first inclusion of "sys/types.h" includes also "machine/types.h" > and this is ok. > Next, the second directive includes again "machine/types.h" and here > it generates the error. Directly including machine/types.h is wrong. This is a header meant to be only included via sys/types.h. It contains this test at the start of the file: #ifndef _SYS_TYPES_H #error "must be included via " #endif /* !_SYS_TYPES_H */ Check this against the files in /usr/include/bits from GLibc. Many of those files are not guarded against multiple inclusions either. Yes, we could guard machine/types.h against multiple inclusion, but the right thing to do would be to change the above code to never include machine/types.h. And if you really think you can't do without, add an #else at least: #ifdef HAVE_SYS_TYPES_H #include #elif defined(HAVE_MACHINE_TYPES_H) #include #endif Corinna -- 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