[PATCH] PR libstdc++/60555 std::system_category() should recognise POSIX errno values
Jonathan Wakely
jwakely@redhat.com
Thu Aug 2 16:12:00 GMT 2018
On 02/08/18 11:32 -0400, David Edelsohn wrote:
>Jonathan
>
>This patch broke AIX bootstrap.
>
>/nasfarm/edelsohn/src/src/libstdc++-v3/src/c++11/system_error.cc: In
>member function 'virtual std::error_condition
>{anonymous}::system_error_category::default_error_condition(int)
>const':
>/nasfarm/edelsohn/src/src/libstdc++-v3/src/c++11/system_error.cc:245:7:
>error: duplicate case value
> case ENOTEMPTY:
> ^~~~
>/nasfarm/edelsohn/src/src/libstdc++-v3/src/c++11/system_error.cc:136:7:
>note: previously used here
> case EEXIST:
> ^~~~
>
>AIX errno.h
>
>/*
> * AIX returns EEXIST where 4.3BSD used ENOTEMPTY;
> * but, the standards insist on unique errno values for each errno.
> * A unique value is reserved for users that want to code case
> * statements for systems that return either EEXIST or ENOTEMPTY.
> */
>#if defined(_ALL_SOURCE) && !defined(_LINUX_SOURCE_COMPAT)
>#define ENOTEMPTY EEXIST /* Directory not empty */
>#else /* not _ALL_SOURCE */
>#define ENOTEMPTY 87
>#endif /* _ALL_SOURCE */
Strange that "linux source compat" is required for POSIX conformance.
>I will add _LINUX_SOURCE_COMPAT and see how bootstrap proceeds. If it
>works, it also will be required in the backport.
Let's just workaround the maybe-not-unique values instead:
--- a/libstdc++-v3/src/c++11/system_error.cc
+++ b/libstdc++-v3/src/c++11/system_error.cc
@@ -241,7 +241,8 @@ namespace
#ifdef ENOTDIR
case ENOTDIR:
#endif
-#ifdef ENOTEMPTY
+#if defined ENOTEMPTY && (!defined EEXIST || ENOTEMPTY != EEXIST)
+ // AIX sometimes uses the same value for EEXIST and ENOTEMPTY
case ENOTEMPTY:
#endif
#ifdef ENOTRECOVERABLE
More information about the Libstdc++
mailing list