diff options
author | Jerome Guitton <guitton@adacore.com> | 2024-05-10 13:16:17 +0000 |
---|---|---|
committer | Marc Poulhiès <poulhies@adacore.com> | 2024-06-14 09:34:20 +0200 |
commit | 7232be268a0a275d43225fef141cf99d2f6bbed9 (patch) | |
tree | 13acfd27f4953304fda9e04e4eca30c370fe23ed /gcc/ada | |
parent | 50c41dd34202b29983a862b5d326bab668402c17 (diff) | |
download | gcc-7232be268a0a275d43225fef141cf99d2f6bbed9.zip gcc-7232be268a0a275d43225fef141cf99d2f6bbed9.tar.gz gcc-7232be268a0a275d43225fef141cf99d2f6bbed9.tar.bz2 |
ada: Simplify handling of VxWorks-specific error codes for ENOENT
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.
Diffstat (limited to 'gcc/ada')
-rw-r--r-- | gcc/ada/sysdep.c | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 443b11f..254c736 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. */ |