Files
Max Desiatov beda41e9de Fix Emscripten libc module under C++ interop, add UUID support (#90332)
Building the `SwiftEmscriptenLibc` module under `-cxx-interoperability-mode` fails two ways. An internal `#include <inttypes.h>` resolves to libc++'s wrapper module and cycles back to this module. `complex.h`'s `#define complex _Complex` leaks through `export *` and breaks libc++'s `std` module. Adding `[no_undeclared_includes]` and moving `complex.h` into an explicit submodule fixes both. Emscripten's `<uuid/uuid.h>` declares only the generic `uuid_generate`, so this adds `uuid_generate_random` and `uuid_generate_time` shims. The symbols are in the auto-linked libc, so UUID is handled like Darwin with no separate library.
2026-07-01 15:12:42 -07:00

82 lines
1.9 KiB
Plaintext

//===--- emscripten-libc.modulemap ----------------------------------------===//
//
// This source file is part of the Swift.org open source project
//
// Copyright (c) 2026 Apple Inc. and the Swift project authors
// Licensed under Apache License v2.0 with Runtime Library Exception
//
// See https://swift.org/LICENSE.txt for license information
// See https://swift.org/CONTRIBUTORS.txt for the list of Swift project authors
//
//===----------------------------------------------------------------------===//
module SwiftEmscriptenLibc [system] [no_undeclared_includes] {
header "stdc-predef.h"
header "features.h"
// C standard library
header "ctype.h"
header "errno.h"
header "fenv.h"
header "inttypes.h"
header "locale.h"
header "math.h"
header "stdio.h"
header "stdlib.h"
header "string.h"
header "time.h"
// POSIX
header "arpa/inet.h"
header "cpio.h"
header "dirent.h"
header "fcntl.h"
header "fmtmsg.h"
header "fnmatch.h"
header "ftw.h"
header "glob.h"
header "iconv.h"
header "ifaddrs.h"
header "langinfo.h"
header "libgen.h"
header "monetary.h"
header "netinet/in.h"
header "netinet/tcp.h"
header "nl_types.h"
header "poll.h"
header "regex.h"
header "sched.h"
header "search.h"
header "semaphore.h"
header "signal.h"
header "strings.h"
header "sys/file.h"
header "sys/ioctl.h"
header "sys/mman.h"
header "sys/resource.h"
header "sys/select.h"
header "sys/socket.h"
header "sys/stat.h"
header "sys/time.h"
header "sys/times.h"
header "sys/types.h"
header "sys/uio.h"
header "sys/un.h"
header "sys/utsname.h"
header "sysexits.h"
header "pthread.h"
header "tar.h"
header "unistd.h"
header "utime.h"
// Emscripten's musl-based libc uses WASI's errno ABI: <bits/errno.h>
// includes this header and maps POSIX errno names to __WASI_ERRNO_* values.
header "wasi/api.h"
export *
explicit module Complex {
header "complex.h"
export *
}
}