diff options
author | Doug Rupp <rupp@adacore.com> | 2019-07-10 09:01:17 +0000 |
---|---|---|
committer | Pierre-Marie de Rodat <pmderodat@gcc.gnu.org> | 2019-07-10 09:01:17 +0000 |
commit | ef8a3d9ef0ace5479d42f7a5382393b5a1a79d96 (patch) | |
tree | 99c069795e020880662bb48894cb6ccbe5cea01d /gcc | |
parent | 32e0627f99f4212695ec13b6d50ca48d1c29ded3 (diff) | |
download | gcc-ef8a3d9ef0ace5479d42f7a5382393b5a1a79d96.zip gcc-ef8a3d9ef0ace5479d42f7a5382393b5a1a79d96.tar.gz gcc-ef8a3d9ef0ace5479d42f7a5382393b5a1a79d96.tar.bz2 |
[Ada] Vxworks7r2 SR0610 coalesced some macro values
SR0600 and SR0610 cannot be differentiated by macro testing (arguably an
oversight in header file version.h) so: The case statement testing for
"file not found" is reformulated into an if/else series of statements to
avoid a problem where two cases have identical values in SR0610, but
different values in SR0600.
2019-07-10 Doug Rupp <rupp@adacore.com>
gcc/ada/
* sysdep.c (__gnat_is_file_not_found_error): Reformulate to also
work for vxworks7r2 SR0610.
From-SVN: r273333
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ada/ChangeLog | 5 | ||||
-rw-r--r-- | gcc/ada/sysdep.c | 38 |
2 files changed, 26 insertions, 17 deletions
diff --git a/gcc/ada/ChangeLog b/gcc/ada/ChangeLog index e4034e4..2c069ab1 100644 --- a/gcc/ada/ChangeLog +++ b/gcc/ada/ChangeLog @@ -1,5 +1,10 @@ 2019-07-10 Doug Rupp <rupp@adacore.com> + * sysdep.c (__gnat_is_file_not_found_error): Reformulate to also + work for vxworks7r2 SR0610. + +2019-07-10 Doug Rupp <rupp@adacore.com> + * env.c (__gnat_environ): Reformulate to also work for vxworks7r2 SR0610. diff --git a/gcc/ada/sysdep.c b/gcc/ada/sysdep.c index 0fbc606..a5f325d 100644 --- a/gcc/ada/sysdep.c +++ b/gcc/ada/sysdep.c @@ -300,7 +300,7 @@ __gnat_set_mode (int handle ATTRIBUTE_UNUSED, int mode ATTRIBUTE_UNUSED) } char * -__gnat_ttyname (int filedes) +__gnat_ttyname (int filedes ATTRIBUTE_UNUSED) { #if defined (__vxworks) return ""; @@ -896,30 +896,34 @@ __gnat_get_task_options (void) #endif int -__gnat_is_file_not_found_error (int errno_val) { - switch (errno_val) { - case ENOENT: +__gnat_is_file_not_found_error (int errno_val) + { + /* WARNING: Do not rewrite this as a switch/case statement. + * Some of the "cases" are duplicated in some versions of + * Vxworks, notably VxWorks7r2 SR0610. */ + if (errno_val == ENOENT) + return 1; #ifdef __vxworks - /* In the case of VxWorks, we also have to take into account various - * filesystem-specific variants of this error. - */ + /* 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) - case S_dosFsLib_FILE_NOT_FOUND: + else if (errno_val == S_dosFsLib_FILE_NOT_FOUND) + return 1; #endif #if ! defined (__RTP__) && (! defined (VTHREADS) || defined (__VXWORKSMILS__)) - case S_nfsLib_NFSERR_NOENT: + 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. */ - case M_nfsStat | ENOENT: + /* An RTP can return an NFS file not found, and the NFS bits must + first be masked on to check the errno. */ + else if (errno_val == (M_nfsStat | ENOENT)) + return 1; #endif #endif - return 1; - - default: - return 0; - } + else + return 0; } #if defined (__linux__) |