summaryrefslogtreecommitdiffstats
path: root/libcxx/src
diff options
context:
space:
mode:
authorDavid Majnemer <david.majnemer@gmail.com>2014-05-29 05:02:22 +0000
committerDavid Majnemer <david.majnemer@gmail.com>2014-05-29 05:02:22 +0000
commit31234844ef002f718d5ab3588535e12ac53819d4 (patch)
tree183a3a6198e611f9777a47e18f893628ec5c3788 /libcxx/src
parent195d8ef452a0712105a88194848db736d415f3c2 (diff)
downloadbcm5719-llvm-31234844ef002f718d5ab3588535e12ac53819d4.tar.gz
bcm5719-llvm-31234844ef002f718d5ab3588535e12ac53819d4.zip
Linux: Correctly identify valid error codes
[syserr.errcat.objects]p4 specifies that system_category().default_error_condition(ev) map to error_condition(posv, generic_category()) if ev could map to a POSIX errno. Linux reserves up to and including 4095 for errno values, use this as a bound. This fixes syserr.errcat.objects/system_category.pass.cpp on Linux. llvm-svn: 209795
Diffstat (limited to 'libcxx/src')
-rw-r--r--libcxx/src/ios.cpp4
-rw-r--r--libcxx/src/system_error.cpp9
2 files changed, 12 insertions, 1 deletions
diff --git a/libcxx/src/ios.cpp b/libcxx/src/ios.cpp
index 03af978cdfe..e24139460a1 100644
--- a/libcxx/src/ios.cpp
+++ b/libcxx/src/ios.cpp
@@ -56,7 +56,9 @@ __iostream_category::message(int ev) const
if (ev != static_cast<int>(io_errc::stream)
#ifdef ELAST
&& ev <= ELAST
-#endif
+#elif defined(__linux__)
+ && ev <= 4095
+#endif // ELAST
)
return __do_message::message(ev);
return string("unspecified iostream_category error");
diff --git a/libcxx/src/system_error.cpp b/libcxx/src/system_error.cpp
index 00920ffd616..d5cb2d4ae1b 100644
--- a/libcxx/src/system_error.cpp
+++ b/libcxx/src/system_error.cpp
@@ -68,6 +68,9 @@ __generic_error_category::message(int ev) const
#ifdef ELAST
if (ev > ELAST)
return string("unspecified generic_category error");
+#elif defined(__linux__)
+ if (ev > 4095)
+ return string("unspecified generic_category error");
#endif // ELAST
return __do_message::message(ev);
}
@@ -100,6 +103,9 @@ __system_error_category::message(int ev) const
#ifdef ELAST
if (ev > ELAST)
return string("unspecified system_category error");
+#elif defined(__linux__)
+ if (ev > 4095)
+ return string("unspecified system_category error");
#endif // ELAST
return __do_message::message(ev);
}
@@ -110,6 +116,9 @@ __system_error_category::default_error_condition(int ev) const _NOEXCEPT
#ifdef ELAST
if (ev > ELAST)
return error_condition(ev, system_category());
+#elif defined(__linux__)
+ if (ev > 4095)
+ return error_condition(ev, system_category());
#endif // ELAST
return error_condition(ev, generic_category());
}
OpenPOWER on IntegriCloud