<html>
    <head>
      <base href="http://llvm.org/bugs/" />
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW --- - libc++ should have its own classic_table"
   href="http://llvm.org/bugs/show_bug.cgi?id=21506">21506</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>libc++ should have its own classic_table
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>libc++
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>unspecified
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>normal
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>All Bugs
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>danalbert@google.com
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>danalbert@google.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>eric@efcs.ca, jonathan@codesourcery.com, llvmbugs@cs.uiuc.edu, mclow.lists@gmail.com
          </td>
        </tr>

        <tr>
          <th>Classification</th>
          <td>Unclassified
          </td>
        </tr></table>
      <p>
        <div>
        <pre>We should probably be shipping our own classic_table instead of relying on one
from the underlying C library.

1. The C library isn't required to even provide such a table. IIRC, musl does
not.
2. The underlying type of the table is undefined, as are the values that map to
each mask. This is responsible for the #ifdef hell stew in [1].
3. Some C libraries (bionic, openbsd, and newlib, possibly others) use an 8-bit
mask for the table. It's still not 100% clear if this is okay, or if we need to
be able to define more than 8 values such that for any two values a and b, a &
b == 0. There are known failures in some libc++ tests [2] caused by this.
Defining our own table with a mask that is at least 16-bits wide (possibly 32)
would get us out of this mess.

I'll upload a patch soonish (once I find time) that does this unless anyone has
good reasons not to take this approach.

[1]: <a href="https://github.com/llvm-mirror/libcxx/blob/master/include/__locale#L324">https://github.com/llvm-mirror/libcxx/blob/master/include/__locale#L324</a>
[2]:
localization/locale.categories/category.ctype/locale.ctype.byname/is_1.pass.cpp
localization/locale.categories/category.ctype/locale.ctype.byname/scan_is.pass.cpp</pre>
        </div>
      </p>
      <hr>
      <span>You are receiving this mail because:</span>
      
      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>