<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </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 - include/__bsd_locale_fallbacks.h uses varargs but doesn't include <stdarg.h>"
   href="https://bugs.llvm.org/show_bug.cgi?id=33370">33370</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>include/__bsd_locale_fallbacks.h uses varargs but doesn't include <stdarg.h>
          </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>All
          </td>
        </tr>

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

        <tr>
          <th>Severity</th>
          <td>enhancement
          </td>
        </tr>

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

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

        <tr>
          <th>Assignee</th>
          <td>unassignedclangbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>michaeljclark@mac.com
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org, mclow.lists@gmail.com
          </td>
        </tr></table>
      <p>
        <div>
        <pre>Created <span class=""><a href="attachment.cgi?id=18600" name="attach_18600" title="Patch to add #include <stdarg.h> to __bsd_locale_fallbacks.h">attachment 18600</a> <a href="attachment.cgi?id=18600&action=edit" title="Patch to add #include <stdarg.h> to __bsd_locale_fallbacks.h">[details]</a></span>
Patch to add #include <stdarg.h> to __bsd_locale_fallbacks.h

I get the following errors when compiling libcxx against musl libc headers:

In file included from third_party/libcxx/src/algorithm.cpp:11:
In file included from third_party/libcxx/include/random:1646:
In file included from third_party/libcxx/include/istream:163:
In file included from third_party/libcxx/include/ostream:140:
In file included from third_party/libcxx/include/locale:220:
third_party/libcxx/include/__bsd_locale_fallbacks.h:106:5: error: use of
undeclared
      identifier 'va_start'
    va_start(__va, __format);

__bsd_locale_fallbacks.h has an include <stdlib.h> but is missing <stdarg.h>
which is where varargs are defined (it may be masked on platforms that include
stdarg.h by default in stdlib.h)

The following patch fixes the issue:

--- a/include/__bsd_locale_fallbacks.h
+++ b/include/__bsd_locale_fallbacks.h
@@ -15,6 +15,7 @@
 #define _LIBCPP_BSD_LOCALE_FALLBACKS_DEFAULTS_H

 #include <stdlib.h>
+#include <stdarg.h>
 #include <memory>

 _LIBCPP_BEGIN_NAMESPACE_STD</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>