From patchwork Fri Jun 14 07:36:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marc_Poulhi=C3=A8s?= X-Patchwork-Id: 1947702 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=adacore.com header.i=@adacore.com header.a=rsa-sha256 header.s=google header.b=US/Ylj8h; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4W0rkY5kddz20Pb for ; Fri, 14 Jun 2024 17:39:01 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 1B7583882161 for ; Fri, 14 Jun 2024 07:39:00 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-wm1-x32d.google.com (mail-wm1-x32d.google.com [IPv6:2a00:1450:4864:20::32d]) by sourceware.org (Postfix) with ESMTPS id 30E9E388264A for ; Fri, 14 Jun 2024 07:36:53 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 30E9E388264A Authentication-Results: sourceware.org; dmarc=pass (p=quarantine dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 30E9E388264A Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2a00:1450:4864:20::32d ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718350615; cv=none; b=QwYjiDOZvkpdTAMXhyYJ14HotD2r8nEEPjFBcUBaiKHJLurFU436mcpNeNYuB85sLPEuR//VLzqqc/BPCot5ULdNDU6MCddZSwFMCY45IogccJANIQ7RnzIHHiOCqZ8GGnlIanTux+soOEG8iaoJLAbimJxp23xd1PnEA952O/Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1718350615; c=relaxed/simple; bh=JcvsjAOZ4BjvnDg+FHSitcgU2UnMnmaAxx3+JCBNrII=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=PU3O2ORCGHu8yqcc5CxP7q8q/sVQ29/ySAONjkyFW6g6UwnLwb7UwVnPGi3l6PVfhfykeZQ0iTSaXTahkWCIEhwC+RzMQ1UeNaLg9qAqIH5ja6QvVZ87wfZLQXr1IF4xFb8jrYvEILdhAV64Tuj/21q3Km3eppQo3ANR16HDkeI= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-wm1-x32d.google.com with SMTP id 5b1f17b1804b1-42165f6645fso16325135e9.2 for ; Fri, 14 Jun 2024 00:36:53 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; t=1718350612; x=1718955412; darn=gcc.gnu.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=AF6EsGnrTz5pfCX9S0w8NjA5UP6W/pE4vMhUq1zS0ug=; b=US/Ylj8hwxgORTe1rhyLwa/EVvChIGLCvEmgVE5BQOcidi+c8VnXcGQjQ6ixPRbR8G rqagP71i87biccaxdNJlzTmRvfzveSAtdS/jbPpVdmsxEABPHpYatPkoEfP4ZYDO/DZj vThYAaY42hVS9N8m8mR5bPNcv1pzDN6wMJkTDrd+KaFPdZA0ocBb67Pwmd7z4Gtkrf5z qdYo8ENi1n/zYop+VBod8RpGiQuk1+dbHfFhMvEd1XRQdxudbCOnRqvy/2R2K6Zcsjvl Y2ERb3lG0VJwBGLjDoniyG3wzAuI8rl8yO7liFUs3VIjDXfnx6guh5qPCkQgPvHd92qQ 7ALg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1718350612; x=1718955412; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=AF6EsGnrTz5pfCX9S0w8NjA5UP6W/pE4vMhUq1zS0ug=; b=TRs1SzH3znEk1JBUGsb+qlOUODhNJ4eNzkfrg1/h6y+PQuuHmzD9sbvji6zeHQnItA BfRDmctvCPfIy6/XoiB8NxkRUu1XkTHiroBym5GNub/JzWyrrigpmWJe9/bZOZYiq68T CfvJRuwVd8nrDRpASSZCrrz9j0V5USykVobp40NhcdJJutW22k2fAz/001D/9aUUKGnR oNU6gasL+7uEr3h3zF6d71x4zfmezvsJ1bSPiSMCkyCTiCc160sFo8glbZdNaxPPfpe5 HLV+CuHjUypy8XL+hCmqM3Oo8OOrOOkdrffDPEL4tyADZOaxwFYS+X8pDplMUBBPp2WP kK8Q== X-Gm-Message-State: AOJu0YwKQR3XA7qecfTXu7qhvtY5Wr6PKVCMOWKQdt9LDn3dVaESPKEj uyHAWKlXeqZZh1dGIBYwQptlKwjz4KPhLT3EC8Gdo+imBVIoCgui4YcugLFghALGva39UV4Xv5k = X-Google-Smtp-Source: AGHT+IFqCQcxpXDpicQUO3Yd78XWOa3Wrx0c/r305JDGH/n8w2H0sqkp99NNXK2VnBKLHvm+jZRxxQ== X-Received: by 2002:a05:600c:4691:b0:421:de31:7a with SMTP id 5b1f17b1804b1-423048228dcmr17682105e9.8.1718350611930; Fri, 14 Jun 2024 00:36:51 -0700 (PDT) Received: from localhost.localdomain ([2001:861:3382:1a90:cb5c:2e27:9d1c:5033]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-36075093636sm3558191f8f.14.2024.06.14.00.36.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 14 Jun 2024 00:36:51 -0700 (PDT) From: =?utf-8?q?Marc_Poulhi=C3=A8s?= To: gcc-patches@gcc.gnu.org Cc: Jerome Guitton Subject: [COMMITTED 09/16] ada: Simplify handling of VxWorks-specific error codes for ENOENT Date: Fri, 14 Jun 2024 09:36:25 +0200 Message-ID: <20240614073633.2089692-9-poulhies@adacore.com> X-Mailer: git-send-email 2.45.1 In-Reply-To: <20240614073633.2089692-1-poulhies@adacore.com> References: <20240614073633.2089692-1-poulhies@adacore.com> MIME-Version: 1.0 X-Spam-Status: No, score=-13.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces+incoming=patchwork.ozlabs.org@gcc.gnu.org From: Jerome Guitton These error codes were defined on older versions of VxWorks (5, 6, 7 SR0540) and now they are either not defined or they fallback to ENOENT. To handle these cases without using complex tests against vxworks versions, leverage on __has_include and provide a fallback to ENOENT if these error codes are not defined. gcc/ada/ * sysdep.c (S_dosFsLib_FILE_NOT_FOUND, S_nfsLib_NFSERR_NOENT): New macros, falback to ENOENT when not already defined. (__gnat_is_file_not_found_error): Use these new macros to remove tests against VxWorks flavors. Tested on x86_64-pc-linux-gnu, committed on master. --- gcc/ada/sysdep.c | 27 ++++++++++++++++++++------- 1 file changed, 20 insertions(+), 7 deletions(-) diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 443b11f4302..254c736bec4 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -35,18 +35,35 @@ #ifdef __vxworks #include "vxWorks.h" #include "ioLib.h" -#if ! defined (VTHREADS) +/* VxWorks 5, 6 and 7 SR0540 expose error codes that need to be handled + as ENOENT. On later versions: + - either they are defined as ENOENT (vx7r2); + - or the corresponding system includes are not provided (Helix Cert). */ + +#if __has_include ("dosFsLib.h") +/* On helix-cert, this include is only provided for RTPs. */ #include "dosFsLib.h" #endif -#if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) + +#ifndef S_dosFsLib_FILE_NOT_FOUND +#define S_dosFsLib_FILE_NOT_FOUND ENOENT +#endif + +#if __has_include ("nfsLib.h") +/* This include is not provided for RTPs or on helix-cert. */ # include "nfsLib.h" #endif + +#ifndef S_nfsLib_NFSERR_NOENT +#define S_nfsLib_NFSERR_NOENT ENOENT +#endif + #include "selectLib.h" #include "version.h" #if defined (__RTP__) # include "vwModNum.h" #endif /* __RTP__ */ -#endif +#endif /* __vxworks */ #ifdef __ANDROID__ #undef __linux__ @@ -912,14 +929,10 @@ __gnat_is_file_not_found_error (int errno_val) /* In the case of VxWorks, we also have to take into account various * filesystem-specific variants of this error. */ -#if ! defined (VTHREADS) && (_WRS_VXWORKS_MAJOR < 7) else if (errno_val == S_dosFsLib_FILE_NOT_FOUND) return 1; -#endif -#if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) else if (errno_val == S_nfsLib_NFSERR_NOENT) return 1; -#endif #if defined (__RTP__) /* An RTP can return an NFS file not found, and the NFS bits must first be masked on to check the errno. */