[cfe-commits] [libcxx] r127303 - /libcxx/trunk/include/locale

Howard Hinnant hhinnant at apple.com
Tue Mar 8 17:03:19 PST 2011


Author: hhinnant
Date: Tue Mar  8 19:03:19 2011
New Revision: 127303

URL: http://llvm.org/viewvc/llvm-project?rev=127303&view=rev
Log:
Chris Jefferson found a defect in the C++0x working draft by trying to run libc++ against boost.  I've submitted an issue to the LWG, and this commit attempts to implement the proposed resolution of that defect report.  I'd point to the issue but it hasn't been put into the LWG list yet.  The title of the issue will be: Stage 2 accumulate incompatibilty

Modified:
    libcxx/trunk/include/locale

Modified: libcxx/trunk/include/locale
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/locale?rev=127303&r1=127302&r2=127303&view=diff
==============================================================================
--- libcxx/trunk/include/locale (original)
+++ libcxx/trunk/include/locale Tue Mar  8 19:03:19 2011
@@ -522,6 +522,12 @@
                   unsigned& __dc, _CharT __thousands_sep, const string& __grouping,
                   unsigned* __g, unsigned*& __g_end, _CharT* __atoms)
 {
+    if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25]))
+    {
+        *__a_end++ = __ct == __atoms[24] ? '+' : '-';
+        __dc = 0;
+        return 0;
+    }
     if (__ct == __thousands_sep && __grouping.size() != 0)
     {
         if (__g_end-__g < __num_get_buf_sz)
@@ -532,22 +538,28 @@
         return 0;
     }
     ptrdiff_t __f = find(__atoms, __atoms + 26, __ct) - __atoms;
-    if (__f >= 26)
+    if (__f >= 24)
         return -1;
-    if (__a_end-__a < __num_get_buf_sz - 1)
-        *__a_end++ = __src[__f];
     switch (__base)
     {
     case 8:
     case 10:
         if (__f >= __base)
-            return 0;
+            return -1;
         break;
-    default:
-        if (__f >= 22)
+    case 16:
+        if (__f < 22)
+            break;
+        if (__a_end != __a && __a_end - __a <= 2 && __a_end[-1] == '0')
+        {
+            __dc = 0;
+            *__a_end++ = __src[__f];
             return 0;
-        break;
+        }
+        return -1;
     }
+    if (__a_end-__a < __num_get_buf_sz - 1)
+        *__a_end++ = __src[__f];
     ++__dc;
     return 0;
 }





More information about the cfe-commits mailing list