Message ID | 20240128114424.35213-1-iain@sandoe.co.uk |
---|---|
State | Accepted |
Headers |
Return-Path: <gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7301:2087:b0:106:209c:c626 with SMTP id gs7csp6605dyb; Sun, 28 Jan 2024 03:45:12 -0800 (PST) X-Google-Smtp-Source: AGHT+IHaUtv5SpdS9fC35CRmdoubBBwbmRoQfPXKwTykW2GddbCUYI0cptw9zthtLlDh8u7d4Le0 X-Received: by 2002:a05:622a:1a26:b0:42a:4b83:392b with SMTP id f38-20020a05622a1a2600b0042a4b83392bmr4464005qtb.60.1706442312543; Sun, 28 Jan 2024 03:45:12 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1706442312; cv=pass; d=google.com; s=arc-20160816; b=u3Q3TEdsN1YEEQ5rlTwM5XTOBpeOoxknZ2i4c4kLzfqq/dFbFojdsLxo2lU8AQPR8U 8LMiAKD9+us/a0SccpjooCN0sV+ag3KdxDO+A6YQ8LXqGHymAwx69fdtSA+GS+XR//9z eatlMOqhBq9SRLgTffsfKBD+2KvrtF3IN+5AfcLxGd+3R1ppK6xZ9y+e5c6oUwRdg7kV B43gTJnEawVfwJyRl+raDjNHEef9uGMGfMAAmgdJTXF44WT0Sewda0a8pp+44nYd3qa/ ADlxRO+HFQyjGr7hdkDsOfGqythXGf0Aylchs8HxMSDgICwssg40/H5mSMDoabwRLQMp Odyw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=errors-to:reply-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:message-id:date:subject:cc:to:from:dkim-signature :arc-filter:dmarc-filter:delivered-to; bh=0xIlmY7nbUOCBWqOTNMK8NFTKXuOLOgsHrO8q8zwDEo=; fh=tqzPN7l85q95NYP5av7QaGcDuayEHcG3UoLCJC8vblc=; b=TytrrGuU8sRwyExNG+TnSHlHKOVFkqhVASxJwLgisEs/eycrRbrKHmkU6UVOULoELq SC6dM/PRCz79rMfZo9BHeHzJdnCkku1jePJP0iQqKQmU6b8JI6GzFJwVP785jTqhfzph aSF+AuU+NkRrGzLmY0cGM3xcmxfH9+PP7M4x2dLt7LKE+e6WZTRT4yht0tJ9FaaHsVlk CEi6Fe5km8Y1+DTKnQ7GrXakChugP1mH35qH26YV2V3Cdsq+eqR8Sj3i/tM/hSVoN2rD Dn3y3/C4x/CcGsQjICJDovc0qkgczzkdsVSNbM3n59Anekh+AW67OBGCOwNsOfCT8BKr 71Sg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ndVzlFxc; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (server2.sourceware.org. [2620:52:3:1:0:246e:9693:128c]) by mx.google.com with ESMTPS id g7-20020ac87d07000000b0042a9e06b1c4si699035qtb.742.2024.01.28.03.45.12 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 28 Jan 2024 03:45:12 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) client-ip=2620:52:3:1:0:246e:9693:128c; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20230601 header.b=ndVzlFxc; arc=pass (i=1); spf=pass (google.com: domain of gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org designates 2620:52:3:1:0:246e:9693:128c as permitted sender) smtp.mailfrom="gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org"; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 43D1C3858284 for <ouuuleilei@gmail.com>; Sun, 28 Jan 2024 11:45:12 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wr1-x42c.google.com (mail-wr1-x42c.google.com [IPv6:2a00:1450:4864:20::42c]) by sourceware.org (Postfix) with ESMTPS id 838843858D20 for <gcc-patches@gcc.gnu.org>; Sun, 28 Jan 2024 11:44:28 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 838843858D20 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 838843858D20 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::42c ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706442270; cv=none; b=I/sl4itJKsAyqyeBv3h/lvnrVxeSRG7HVf8Qe8709alG+Z6tW+b4QWHxQwgLkIPZHllyUZhmAu7HyjgIF6NAEis2i43I8G6XYD8A7Lv9Tuc5AfgFoWs48vBq/tfSeKPMvZlh0TNYhbybzP+jGY3t68N3l2CQYvs3VcUff632lEw= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1706442270; c=relaxed/simple; bh=PUMAoxG1fZDtYOj7DO9gloa9EAxxq8sDNe9M2c+r2U8=; h=DKIM-Signature:From:To:Subject:Date:Message-Id:MIME-Version; b=o+M0lK18SxDziJSXP3EBIH7V0VIrtDifqYFUPfZ1Rp8KBGiv+nO3wkFxk4fwdGRyXY8cMf/fHCYD3BJgbPvX5+6lFIPUdorf6+683YZSum5ypUervdwnWyMhFLT/yyhhJOFTGr5NnJ0rzvPAKIoqx+7LMvzPbJESdBsGykvulhk= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wr1-x42c.google.com with SMTP id ffacd0b85a97d-33ae42033e2so848883f8f.1 for <gcc-patches@gcc.gnu.org>; Sun, 28 Jan 2024 03:44:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1706442266; x=1707047066; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=0xIlmY7nbUOCBWqOTNMK8NFTKXuOLOgsHrO8q8zwDEo=; b=ndVzlFxcLlfqAfgXygBMnvVioA7bgDY0RKbmwCUo19x+sYzuz0g7jWe3myUbk5mjcM tM4j52ax8O4NoyoNLsZfeoICriqYD2x1MPbbSWokh5iUxK+VdGiySaTMIUq1oQdmZeN1 CMoGp+iCGbh8Ud3+pU1eKvKh4wvRZC4iuYHdY8BhC3jrOkvKi8IO/MRrL+DKh5NJzjwh a0+onoNmQTwXRnOFznJ22U4Qm1ccXZ0/YzilaY+US4xaTbZ0zA6DmPDKESIXQEts77GD lXG2r0Uv9UH1XguHr17y5iIc5C/9qjv+BUFnLSjBodFeFTQCBf8y+H3RknlgRhAvrjmt 2lhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1706442266; x=1707047066; h=content-transfer-encoding:mime-version:reply-to:message-id:date :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=0xIlmY7nbUOCBWqOTNMK8NFTKXuOLOgsHrO8q8zwDEo=; b=F2+P0loXngKOLO1OokkJ0MAZ7x/CRtfuxJAb7GUuX7XjRAwYDEToH5Sluhq0puHOTs JcRfelxmSDjDQaVf9lVZkRvuuliHgxlaq97WPafuC/Pu4yTSIgJUueR91vHVeb8gZQ73 5sMf0qhOVRmiGlm2AfTh27LmgdDnZYb+Gee4ZNpLMRrkCkFkuRQc0foqkbmgIxwty+y/ 4yluXdq/OXZTI0sCg1rL/WvQ8JaqOfG1UNDeDsFj3XowZ49x7ezqkXxziSFGxh8Wy0qk sMpS5XfGkTTYIXLIk3mtYMfnmhowJuAVP0xQdGuXumVNEmMm0TeIeQn3bZY0wxTwO6Qb HQTw== X-Gm-Message-State: AOJu0YwfZVbyf3r4dWqVX7Dx4slz/J8Eut/I6B4jBLTZ0OLWjkHtGlCS 3M/vmY081D2+J3lipn7tmqSyqytudGYDmHsDzd4wp4NZhAOT9y1cBIerqdlM X-Received: by 2002:adf:e48c:0:b0:33a:eadb:f4ce with SMTP id i12-20020adfe48c000000b0033aeadbf4cemr870260wrm.17.1706442265977; Sun, 28 Jan 2024 03:44:25 -0800 (PST) Received: from localhost.localdomain (host81-138-1-83.in-addr.btopenworld.com. [81.138.1.83]) by smtp.gmail.com with ESMTPSA id l6-20020a5d4806000000b003392ae3aee8sm5430142wrq.97.2024.01.28.03.44.25 (version=TLS1_3 cipher=TLS_CHACHA20_POLY1305_SHA256 bits=256/256); Sun, 28 Jan 2024 03:44:25 -0800 (PST) From: Iain Sandoe <iains.gcc@gmail.com> X-Google-Original-From: Iain Sandoe <iain@sandoe.co.uk> To: gcc-patches@gcc.gnu.org Cc: dmalcolm@redhat.com Subject: [PATCH] jit: Ensure ssize_t is defined. Date: Sun, 28 Jan 2024 11:44:24 +0000 Message-Id: <20240128114424.35213-1-iain@sandoe.co.uk> X-Mailer: git-send-email 2.39.2 (Apple Git-143) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-8.5 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP, T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list <gcc-patches.gcc.gnu.org> List-Unsubscribe: <https://gcc.gnu.org/mailman/options/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=unsubscribe> List-Archive: <https://gcc.gnu.org/pipermail/gcc-patches/> List-Post: <mailto:gcc-patches@gcc.gnu.org> List-Help: <mailto:gcc-patches-request@gcc.gnu.org?subject=help> List-Subscribe: <https://gcc.gnu.org/mailman/listinfo/gcc-patches>, <mailto:gcc-patches-request@gcc.gnu.org?subject=subscribe> Reply-To: iain@sandoe.co.uk Errors-To: gcc-patches-bounces+ouuuleilei=gmail.com@gcc.gnu.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1789334454483990504 X-GMAIL-MSGID: 1789334454483990504 |
Series |
jit: Ensure ssize_t is defined.
|
|
Checks
Context | Check | Description |
---|---|---|
snail/gcc-patch-check | success | Github commit url |
Commit Message
Iain Sandoe
Jan. 28, 2024, 11:44 a.m. UTC
Tested on i686, x86_64 Darwin, x86_64 Linux,
OK for trunk?
--- 8< ---
On some targets it seems that ssize_t is not defined by any of the
headers transitively included by <stdio.h>. This leads to a bootstrap
fail when jit is enabled.
The fix proposed here is to include sys/types.h when it is available
since that is where Posix specifies that ssize_t is defined.
gcc/jit/ChangeLog:
* libgccjit.h: Conditionally include <sys/types.h> where it is
available to ensure declaration of ssize_t.
Signed-off-by: Iain Sandoe <iain@sandoe.co.uk>
---
gcc/jit/libgccjit.h | 3 +++
1 file changed, 3 insertions(+)
Comments
On Sun, Jan 28, 2024 at 6:45 AM Iain Sandoe <iains.gcc@gmail.com> wrote: > > Tested on i686, x86_64 Darwin, x86_64 Linux, > OK for trunk? > > --- 8< --- > > On some targets it seems that ssize_t is not defined by any of the > headers transitively included by <stdio.h>. This leads to a bootstrap > fail when jit is enabled. > > The fix proposed here is to include sys/types.h when it is available > since that is where Posix specifies that ssize_t is defined. > > gcc/jit/ChangeLog: > > * libgccjit.h: Conditionally include <sys/types.h> where it is > available to ensure declaration of ssize_t. > > Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> > --- > gcc/jit/libgccjit.h | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h > index 235cab053e0..db4f27a48bf 100644 > --- a/gcc/jit/libgccjit.h > +++ b/gcc/jit/libgccjit.h > @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see > #define LIBGCCJIT_H > > #include <stdio.h> > +#if __has_include(<sys/types.h>) Is __has_include() something that we can use unconditionally? > +# include <sys/types.h> /* For ssize_t. */ > +#endif > > #ifdef __cplusplus > extern "C" { > -- > 2.39.2 (Apple Git-143) >
> On 28 Jan 2024, at 21:25, Eric Gallager <egall@gwmail.gwu.edu> wrote: > > On Sun, Jan 28, 2024 at 6:45 AM Iain Sandoe <iains.gcc@gmail.com> wrote: >> >> Tested on i686, x86_64 Darwin, x86_64 Linux, >> OK for trunk? >> >> --- 8< --- >> >> On some targets it seems that ssize_t is not defined by any of the >> headers transitively included by <stdio.h>. This leads to a bootstrap >> fail when jit is enabled. >> >> The fix proposed here is to include sys/types.h when it is available >> since that is where Posix specifies that ssize_t is defined. >> >> gcc/jit/ChangeLog: >> >> * libgccjit.h: Conditionally include <sys/types.h> where it is >> available to ensure declaration of ssize_t. >> >> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> >> --- >> gcc/jit/libgccjit.h | 3 +++ >> 1 file changed, 3 insertions(+) >> >> diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h >> index 235cab053e0..db4f27a48bf 100644 >> --- a/gcc/jit/libgccjit.h >> +++ b/gcc/jit/libgccjit.h >> @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see >> #define LIBGCCJIT_H >> >> #include <stdio.h> >> +#if __has_include(<sys/types.h>) > > Is __has_include() something that we can use unconditionally? Hmm.. maybe we cannot, it seems it was introduced in gcc-4.9 and we only ask for 4.8, IIRC. I guess HAVE_SYS_TYPES_H might be an alternative (I’ll have to retest) Iain > >> +# include <sys/types.h> /* For ssize_t. */ >> +#endif >> >> #ifdef __cplusplus >> extern "C" { >> -- >> 2.39.2 (Apple Git-143)
Hi David, I guess the solution here depends on the scope over which we expect the header to be used. > On 28 Jan 2024, at 23:13, Iain Sandoe <iain@sandoe.co.uk> wrote: >> On 28 Jan 2024, at 21:25, Eric Gallager <egall@gwmail.gwu.edu> wrote: >> On Sun, Jan 28, 2024 at 6:45 AM Iain Sandoe <iains.gcc@gmail.com> wrote: >>> >>> Tested on i686, x86_64 Darwin, x86_64 Linux, >>> OK for trunk? >>> >>> --- 8< --- >>> >>> On some targets it seems that ssize_t is not defined by any of the >>> headers transitively included by <stdio.h>. This leads to a bootstrap >>> fail when jit is enabled. >>> >>> The fix proposed here is to include sys/types.h when it is available >>> since that is where Posix specifies that ssize_t is defined. >>> >>> gcc/jit/ChangeLog: >>> >>> * libgccjit.h: Conditionally include <sys/types.h> where it is >>> available to ensure declaration of ssize_t. >>> >>> Signed-off-by: Iain Sandoe <iain@sandoe.co.uk> >>> --- >>> gcc/jit/libgccjit.h | 3 +++ >>> 1 file changed, 3 insertions(+) >>> >>> diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h >>> index 235cab053e0..db4f27a48bf 100644 >>> --- a/gcc/jit/libgccjit.h >>> +++ b/gcc/jit/libgccjit.h >>> @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see >>> #define LIBGCCJIT_H >>> >>> #include <stdio.h> >>> +#if __has_include(<sys/types.h>) >> >> Is __has_include() something that we can use unconditionally? > > Hmm.. maybe we cannot, it seems it was introduced in gcc-4.9 and we only ask > for 4.8, IIRC. > > I guess HAVE_SYS_TYPES_H might be an alternative (I’ll have to retest) Answering my own question; no that is not going to work either since the header is installed and config.h is not. I guess the question is “is this header ever [meaningfully] consumed by a compiler other than the current GCC that it supports”? e.g. if we expected we could build libgccjit with clang in a “—disable-bootstrap” configuration and expect that to work? The fallback is #ifdef __APPLE__ # include <sys/types.h> /* For ssize_t. */ #endif (which I will test on a number of platform versions). since this breaks bootstrap at stage 2 on affected platform versions, so we need some fix. thanks Iain
diff --git a/gcc/jit/libgccjit.h b/gcc/jit/libgccjit.h index 235cab053e0..db4f27a48bf 100644 --- a/gcc/jit/libgccjit.h +++ b/gcc/jit/libgccjit.h @@ -21,6 +21,9 @@ along with GCC; see the file COPYING3. If not see #define LIBGCCJIT_H #include <stdio.h> +#if __has_include(<sys/types.h>) +# include <sys/types.h> /* For ssize_t. */ +#endif #ifdef __cplusplus extern "C" {