libstdc++: add module std [PR106852]

This patch introduces an installed source form of module std and std.compat.
To help a build system find them, we install a libstdc++.modules.json file
alongside libstdc++.so, which tells the build system where the files are and
any special flags it should use when compiling them (none, in this case).
The format is from a proposal in SG15.  The build system can find this file
with 'gcc -print-file-name=libstdc++.modules.json'.

It seems preferable to use a relative path from this file to the sources so
that moving the installation doesn't break the reference, but I didn't see
any obvious way to compute that without relying on coreutils, perl, or
python, so I wrote a POSIX shell script for it.  The .. canonicalization
bits aren't necessary since I discovered $(abspath), but I guess I might as
well leave them in.

Currently this installs the sources under $(gxx_include_dir)/bits/,
i.e. /usr/include/c++/15/bits.  So with my -fsearch-include-path change,
std.cc can be compiled with g++ -fsearch-include-path bits/std.cc.  Note
that if someone actually tries to #include <bits/std.cc> it will fail with
"error: module control-line cannot be in included file".

Any ideas about a more user-friendly way to express "compile module std" are
welcome.

The sources currently have the extension .cc, like other source files.

std.cc started with m.cencora's implementation in PR114600.  I've made some
adjustments, but more is probably desirable, e.g. of the <algorithm>
handling of namespace ranges, and to remove exports of templates that are
only specialized in a particular header.  I've filled in a bunch of missing
exports, and added some FIXMEs where I noticed bits that are not implemented
yet.

Since bits/stdc++.h also intends to include the whole standard library, I
include it rather than duplicate it.  But stdc++.h comments out <execution>,
due to TBB issues; I include it separately and suppress TBB usage, so module
std won't currently provide parallel execution.

It seemed most convenient for the two files to be monolithic so we don't
need to worry about include paths.  So the C library names that module
std.compat exports in both namespace std and :: are a block of code that is
appended to both files, adjusted based on whether the macro STD_COMPAT is
defined before the block.

In this implementation std.compat imports std; it would also be valid for it
to duplicate everything in std.  I see the libc++ std.compat also imports
std.

As discussed in the PR, module std is supported in C++20 mode even though it
was added in C++23.

Changes to test module std will follow in a separate patch.  In my testing
I've noticed a few compiler bugs that break various testcases, so I don't
expect to enable module std testing by default at first.

	PR libstdc++/106852

libstdc++-v3/ChangeLog:

	* include/bits/version.def: Add __cpp_lib_modules.
	* include/bits/version.h: Regenerate.
	* src/c++23/Makefile.am: Add modules std and std.compat.
	* src/c++23/Makefile.in: Regenerate.
	* src/c++23/std-clib.cc.in: New file.
	* src/c++23/std.cc.in: New file.
	* src/c++23/std.compat.cc.in: New file.
	* src/c++23/libstdc++.modules.json.in: New file.

contrib/ChangeLog:

	* relpath.sh: New file.
This commit is contained in:
Jason Merrill 2024-10-10 17:27:50 -04:00
parent bd59f2eeac
commit 7db55c0ba1
9 changed files with 4237 additions and 16 deletions

81
contrib/relpath.sh Executable file
View File

@ -0,0 +1,81 @@
#!/bin/sh
if [ "$1" = "--help" -o $# -ne 2 -o -f "$1" ]; then
echo Usage: relpath.sh FROM TO
echo Print the relative path from FROM to TO
echo FROM must be a directory, but need not exist
exit 0
fi
from="${1%%/}"
to="${2%%/}"
# The parent directory of a pathname, handling ..
parent() {
name=$(basename "$1")
path=$(dirname "$1")
top=$(basename "$path")
if [ "$top" = ".." ]; then
path=$(parent "$path")
fi
if [ "$name" = ".." ]; then
path=$(parent "$path")
fi
echo $path
}
# Canonicalize a directory that contains '..'.
canonicalize() {
path=$1
suffix=
while ! [ -d "$path" ]; do
name=$(basename "$path")
path=$(parent "$path")
suffix="/$name$suffix"
done
if [ -d "$path" ]; then
echo $(cd "$path"; pwd)$suffix
else
echo $1
fi
}
case "$to$from" in
*..* )
from=$(canonicalize "$from")
to=$(canonicalize "$to")
;;
esac
case "$to$from" in
*..* )
echo unable to canonicalize .. >&2
exit 1
;;
esac
back=
while [ "${to#$from}" = "$to" ]; do
#echo $from too long
from=$(dirname $from);
back=../$back
if [ "$from" = "/" ]; then
echo $to
exit 0
elif [ "$from" = . ]; then
echo no common ancestor between $1 and $2 >&2
exit 1
fi
done
to=${to#$from}
to=${to##/}
back=${back%%/}
if [ -n "$to" ] && [ -n "$back" ]; then
echo $back/$to
elif [ -n "$back$to" ]; then
echo $back$to
else
echo .
fi

View File

@ -1873,6 +1873,15 @@ ftms = {
}; };
}; };
ftms = {
name = modules;
values = {
v = 202207;
cxxmin = 20;
extra_cond = "__cpp_modules";
};
};
// Standard test specifications. // Standard test specifications.
stds[97] = ">= 199711L"; stds[97] = ">= 199711L";
stds[03] = ">= 199711L"; stds[03] = ">= 199711L";

View File

@ -2075,4 +2075,14 @@
#endif /* !defined(__cpp_lib_to_string) && defined(__glibcxx_want_to_string) */ #endif /* !defined(__cpp_lib_to_string) && defined(__glibcxx_want_to_string) */
#undef __glibcxx_want_to_string #undef __glibcxx_want_to_string
#if !defined(__cpp_lib_modules)
# if (__cplusplus >= 202002L) && (__cpp_modules)
# define __glibcxx_modules 202207L
# if defined(__glibcxx_want_all) || defined(__glibcxx_want_modules)
# define __cpp_lib_modules 202207L
# endif
# endif
#endif /* !defined(__cpp_lib_modules) && defined(__glibcxx_want_modules) */
#undef __glibcxx_want_modules
#undef __glibcxx_want_all #undef __glibcxx_want_all

View File

@ -25,6 +25,40 @@ include $(top_srcdir)/fragment.am
# Convenience library for C++23 runtime. # Convenience library for C++23 runtime.
noinst_LTLIBRARIES = libc++23convenience.la noinst_LTLIBRARIES = libc++23convenience.la
# Module std support. Not compiled for now, only installed.
# Let's install the interface units in the bits subdirectory.
toolexeclib_DATA = libstdc++.modules.json
includebitsdir = $(gxx_include_dir)/bits
includebits_DATA = std.cc std.compat.cc
# The manifest to be installed uses the relative path between install dirs.
libstdc++.modules.json: libstdc++.modules.json.in
relpath=$$($(toplevel_srcdir)/contrib/relpath.sh \
$(abspath $(toolexeclibdir)) \
$(abspath $(includebitsdir))) && \
sed "s,@MODPATH@,$$relpath," $< > $@
# The uninstalled manifest uses the relative path to builddir.
stamp-module-manifest: libstdc++.modules.json.in
@-mkdir -p ../.libs
sed "s,@MODPATH@,../c++23," $< \
> ../.libs/libstdc++.modules.json
@$(STAMP) $@
# Add the C library exports to both modules.
std.cc: std.cc.in std-clib.cc.in
cat $^ > $@
std.compat.cc: std.compat.cc.in std-clib.cc.in
cat $^ > $@
# Also put the interface units in the build-includes bits directory.
stamp-modules-bits: $(includebits_DATA)
@-mkdir -p $(top_builddir)/include/bits
-cd $(top_builddir)/include/bits && $(LN_S) $(abspath $?) . 2>/dev/null
@$(STAMP) $@
all-local: stamp-module-manifest stamp-modules-bits
headers = headers =
if ENABLE_EXTERN_TEMPLATE if ENABLE_EXTERN_TEMPLATE

View File

@ -14,6 +14,7 @@
@SET_MAKE@ @SET_MAKE@
VPATH = @srcdir@ VPATH = @srcdir@
am__is_gnu_make = { \ am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \ if test -z '$(MAKELEVEL)'; then \
@ -162,6 +163,36 @@ am__can_run_installinfo = \
n|no|NO) false;; \ n|no|NO) false;; \
*) (install-info --version) >/dev/null 2>&1;; \ *) (install-info --version) >/dev/null 2>&1;; \
esac esac
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
am__vpath_adj = case $$p in \
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
*) f=$$p;; \
esac;
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
am__install_max = 40
am__nobase_strip_setup = \
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
am__nobase_strip = \
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
am__nobase_list = $(am__nobase_strip_setup); \
for p in $$list; do echo "$$p $$p"; done | \
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
if (++n[$$2] == $(am__install_max)) \
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
END { for (dir in files) print dir, files[dir] }'
am__base_list = \
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
am__uninstall_files_from_dir = { \
test -z "$$files" \
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
$(am__cd) "$$dir" && rm -f $$files; }; \
}
am__installdirs = "$(DESTDIR)$(includebitsdir)" \
"$(DESTDIR)$(toolexeclibdir)"
DATA = $(includebits_DATA) $(toolexeclib_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP) am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
# Read a list of newline-separated strings from the standard input, # Read a list of newline-separated strings from the standard input,
# and print each of them once, without duplicates. Input order is # and print each of them once, without duplicates. Input order is
@ -424,6 +455,12 @@ AM_CPPFLAGS = $(GLIBCXX_INCLUDES) $(CPPFLAGS)
# Convenience library for C++23 runtime. # Convenience library for C++23 runtime.
noinst_LTLIBRARIES = libc++23convenience.la noinst_LTLIBRARIES = libc++23convenience.la
# Module std support. Not compiled for now, only installed.
# Let's install the interface units in the bits subdirectory.
toolexeclib_DATA = libstdc++.modules.json
includebitsdir = $(gxx_include_dir)/bits
includebits_DATA = std.cc std.compat.cc
headers = headers =
# XTEMPLATE_FLAGS = # XTEMPLATE_FLAGS =
@ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources = @ENABLE_EXTERN_TEMPLATE_FALSE@inst_sources =
@ -566,6 +603,48 @@ mostlyclean-libtool:
clean-libtool: clean-libtool:
-rm -rf .libs _libs -rm -rf .libs _libs
install-includebitsDATA: $(includebits_DATA)
@$(NORMAL_INSTALL)
@list='$(includebits_DATA)'; test -n "$(includebitsdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(includebitsdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(includebitsdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(includebitsdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(includebitsdir)" || exit $$?; \
done
uninstall-includebitsDATA:
@$(NORMAL_UNINSTALL)
@list='$(includebits_DATA)'; test -n "$(includebitsdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(includebitsdir)'; $(am__uninstall_files_from_dir)
install-toolexeclibDATA: $(toolexeclib_DATA)
@$(NORMAL_INSTALL)
@list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
if test -n "$$list"; then \
echo " $(MKDIR_P) '$(DESTDIR)$(toolexeclibdir)'"; \
$(MKDIR_P) "$(DESTDIR)$(toolexeclibdir)" || exit 1; \
fi; \
for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
echo "$$d$$p"; \
done | $(am__base_list) | \
while read files; do \
echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(toolexeclibdir)'"; \
$(INSTALL_DATA) $$files "$(DESTDIR)$(toolexeclibdir)" || exit $$?; \
done
uninstall-toolexeclibDATA:
@$(NORMAL_UNINSTALL)
@list='$(toolexeclib_DATA)'; test -n "$(toolexeclibdir)" || list=; \
files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
dir='$(DESTDIR)$(toolexeclibdir)'; $(am__uninstall_files_from_dir)
ID: $(am__tagged_files) ID: $(am__tagged_files)
$(am__define_uniq_tagged_files); mkid -fID $$unique $(am__define_uniq_tagged_files); mkid -fID $$unique
@ -620,8 +699,11 @@ distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
check-am: all-am check-am: all-am
check: check-am check: check-am
all-am: Makefile $(LTLIBRARIES) all-am: Makefile $(LTLIBRARIES) $(DATA) all-local
installdirs: installdirs:
for dir in "$(DESTDIR)$(includebitsdir)" "$(DESTDIR)$(toolexeclibdir)"; do \
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
done
install: install-am install: install-am
install-exec: install-exec-am install-exec: install-exec-am
install-data: install-data-am install-data: install-data-am
@ -674,13 +756,13 @@ info: info-am
info-am: info-am:
install-data-am: install-data-am: install-includebitsDATA
install-dvi: install-dvi-am install-dvi: install-dvi-am
install-dvi-am: install-dvi-am:
install-exec-am: install-exec-am: install-toolexeclibDATA
install-html: install-html-am install-html: install-html-am
@ -719,27 +801,57 @@ ps: ps-am
ps-am: ps-am:
uninstall-am: uninstall-am: uninstall-includebitsDATA uninstall-toolexeclibDATA
.MAKE: install-am install-strip .MAKE: install-am install-strip
.PHONY: CTAGS GTAGS TAGS all all-am check check-am clean clean-generic \ .PHONY: CTAGS GTAGS TAGS all all-am all-local check check-am clean \
clean-libtool clean-noinstLTLIBRARIES cscopelist-am ctags \ clean-generic clean-libtool clean-noinstLTLIBRARIES \
ctags-am distclean distclean-compile distclean-generic \ cscopelist-am ctags ctags-am distclean distclean-compile \
distclean-libtool distclean-tags dvi dvi-am html html-am info \ distclean-generic distclean-libtool distclean-tags dvi dvi-am \
info-am install install-am install-data install-data-am \ html html-am info info-am install install-am install-data \
install-dvi install-dvi-am install-exec install-exec-am \ install-data-am install-dvi install-dvi-am install-exec \
install-html install-html-am install-info install-info-am \ install-exec-am install-html install-html-am \
install-includebitsDATA install-info install-info-am \
install-man install-pdf install-pdf-am install-ps \ install-man install-pdf install-pdf-am install-ps \
install-ps-am install-strip installcheck installcheck-am \ install-ps-am install-strip install-toolexeclibDATA \
installdirs maintainer-clean maintainer-clean-generic \ installcheck installcheck-am installdirs maintainer-clean \
mostlyclean mostlyclean-compile mostlyclean-generic \ maintainer-clean-generic mostlyclean mostlyclean-compile \
mostlyclean-libtool pdf pdf-am ps ps-am tags tags-am uninstall \ mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
uninstall-am tags tags-am uninstall uninstall-am uninstall-includebitsDATA \
uninstall-toolexeclibDATA
.PRECIOUS: Makefile .PRECIOUS: Makefile
# The manifest to be installed uses the relative path between install dirs.
libstdc++.modules.json: libstdc++.modules.json.in
relpath=$$($(toplevel_srcdir)/contrib/relpath.sh \
$(abspath $(toolexeclibdir)) \
$(abspath $(includebitsdir))) && \
sed "s,@MODPATH@,$$relpath," $< > $@
# The uninstalled manifest uses the relative path to builddir.
stamp-module-manifest: libstdc++.modules.json.in
@-mkdir -p ../.libs
sed "s,@MODPATH@,../c++23," $< \
> ../.libs/libstdc++.modules.json
@$(STAMP) $@
# Add the C library exports to both modules.
std.cc: std.cc.in std-clib.cc.in
cat $^ > $@
std.compat.cc: std.compat.cc.in std-clib.cc.in
cat $^ > $@
# Also put the interface units in the build-includes bits directory.
stamp-modules-bits: $(includebits_DATA)
@-mkdir -p $(top_builddir)/include/bits
-cd $(top_builddir)/include/bits && $(LN_S) $(abspath $?) . 2>/dev/null
@$(STAMP) $@
all-local: stamp-module-manifest stamp-modules-bits
vpath % $(top_srcdir)/src/c++23 vpath % $(top_srcdir)/src/c++23
# Use C++26 so that std::filebuf::native_handle() is available. # Use C++26 so that std::filebuf::native_handle() is available.

View File

@ -0,0 +1,17 @@
// C++ module metadata, to install alongside libstdc++.so
{
"version": 1,
"revision": 1,
"modules": [
{
"logical-name": "std",
"source-path": "@MODPATH@/std.cc",
"is-std-library": true
},
{
"logical-name": "std.compat",
"source-path": "@MODPATH@/std.compat.cc",
"is-std-library": true
}
]
}

View File

@ -0,0 +1,676 @@
// C standard library exports for -*- C++ -*- std and std.compat modules
// This file is appended to std.cc.in or std-compat.cc.in.
#ifdef STD_COMPAT
#define C_LIB_NAMESPACE
#else
#define C_LIB_NAMESPACE namespace std
#endif
// C standard library headers [tab:headers.cpp.c]
// 19.3 <cassert>
// No exports
// 23.5.1 <cctype>
export C_LIB_NAMESPACE
{
using std::isalnum;
using std::isalpha;
using std::isblank;
using std::iscntrl;
using std::isdigit;
using std::isgraph;
using std::islower;
using std::isprint;
using std::ispunct;
using std::isspace;
using std::isupper;
using std::isxdigit;
using std::tolower;
using std::toupper;
}
// 19.4 <cerrno>
// No exports
// 28.3 <cfenv>
export C_LIB_NAMESPACE
{
using std::feclearexcept;
using std::fegetenv;
using std::fegetexceptflag;
using std::fegetround;
using std::feholdexcept;
using std::fenv_t;
using std::feraiseexcept;
using std::fesetenv;
using std::fesetexceptflag;
using std::fesetround;
using std::fetestexcept;
using std::feupdateenv;
using std::fexcept_t;
}
// 17.3.7 <cfloat> [cfloat.syn]
// No exports, only provides macros
// 31.13.2 <cinttypes>
export C_LIB_NAMESPACE
{
using std::imaxabs;
using std::imaxdiv;
using std::imaxdiv_t;
using std::strtoimax;
using std::strtoumax;
using std::wcstoimax;
using std::wcstoumax;
}
// 17.3.6 <climits> [climits.syn]
// No exports, only provides macros
// 30.5 <clocale>
export C_LIB_NAMESPACE
{
using std::lconv;
using std::localeconv;
using std::setlocale;
// LC_* macros not exported
}
// 28.7.1 <cmath>
export C_LIB_NAMESPACE
{
using std::abs;
using std::acos;
using std::acosf;
using std::acosh;
using std::acoshf;
using std::acoshl;
using std::acosl;
using std::asin;
using std::asinf;
using std::asinh;
using std::asinhf;
using std::asinhl;
using std::asinl;
using std::atan;
using std::atan2;
using std::atan2f;
using std::atan2l;
using std::atanf;
using std::atanh;
using std::atanhf;
using std::atanhl;
using std::atanl;
using std::cbrt;
using std::cbrtf;
using std::cbrtl;
using std::ceil;
using std::ceilf;
using std::ceill;
using std::copysign;
using std::copysignf;
using std::copysignl;
using std::cos;
using std::cosf;
using std::cosh;
using std::coshf;
using std::coshl;
using std::cosl;
using std::double_t;
using std::erf;
using std::erfc;
using std::erfcf;
using std::erfcl;
using std::erff;
using std::erfl;
using std::exp;
using std::exp2;
using std::exp2f;
using std::exp2l;
using std::expf;
using std::expl;
using std::expm1;
using std::expm1f;
using std::expm1l;
using std::fabs;
using std::fabsf;
using std::fabsl;
using std::fdim;
using std::fdimf;
using std::fdiml;
using std::float_t;
using std::floor;
using std::floorf;
using std::floorl;
using std::fma;
using std::fmaf;
using std::fmal;
using std::fmax;
using std::fmaxf;
using std::fmaxl;
using std::fmin;
using std::fminf;
using std::fminl;
using std::fmod;
using std::fmodf;
using std::fmodl;
using std::fpclassify;
using std::frexp;
using std::frexpf;
using std::frexpl;
using std::hypot;
using std::hypotf;
using std::hypotl;
using std::ilogb;
using std::ilogbf;
using std::ilogbl;
using std::isfinite;
using std::isgreater;
using std::isgreaterequal;
using std::isinf;
using std::isless;
using std::islessequal;
using std::islessgreater;
using std::isnan;
using std::isnormal;
using std::isunordered;
using std::ldexp;
using std::ldexpf;
using std::ldexpl;
#ifndef STD_COMPAT
using std::lerp;
#endif
using std::lgamma;
using std::lgammaf;
using std::lgammal;
using std::llrint;
using std::llrintf;
using std::llrintl;
using std::llround;
using std::llroundf;
using std::llroundl;
using std::log;
using std::log10;
using std::log10f;
using std::log10l;
using std::log1p;
using std::log1pf;
using std::log1pl;
using std::log2;
using std::log2f;
using std::log2l;
using std::logb;
using std::logbf;
using std::logbl;
using std::logf;
using std::logl;
using std::lrint;
using std::lrintf;
using std::lrintl;
using std::lround;
using std::lroundf;
using std::lroundl;
using std::modf;
using std::modff;
using std::modfl;
using std::nan;
using std::nanf;
using std::nanl;
using std::nearbyint;
using std::nearbyintf;
using std::nearbyintl;
using std::nextafter;
using std::nextafterf;
using std::nextafterl;
using std::nexttoward;
using std::nexttowardf;
using std::nexttowardl;
using std::pow;
using std::powf;
using std::powl;
using std::remainder;
using std::remainderf;
using std::remainderl;
using std::remquo;
using std::remquof;
using std::remquol;
using std::rint;
using std::rintf;
using std::rintl;
using std::round;
using std::roundf;
using std::roundl;
using std::scalbln;
using std::scalblnf;
using std::scalblnl;
using std::scalbn;
using std::scalbnf;
using std::scalbnl;
using std::signbit;
using std::sin;
using std::sinf;
using std::sinh;
using std::sinhf;
using std::sinhl;
using std::sinl;
using std::sqrt;
using std::sqrtf;
using std::sqrtl;
using std::tan;
using std::tanf;
using std::tanh;
using std::tanhf;
using std::tanhl;
using std::tanl;
using std::tgamma;
using std::tgammaf;
using std::tgammal;
using std::trunc;
using std::truncf;
using std::truncl;
#if __cpp_lib_math_special_functions && !defined(STD_COMPAT)
using std::assoc_laguerre;
using std::assoc_laguerref;
using std::assoc_laguerrel;
using std::assoc_legendre;
using std::assoc_legendref;
using std::assoc_legendrel;
using std::beta;
using std::betaf;
using std::betal;
using std::comp_ellint_1;
using std::comp_ellint_1f;
using std::comp_ellint_1l;
using std::comp_ellint_2;
using std::comp_ellint_2f;
using std::comp_ellint_2l;
using std::comp_ellint_3;
using std::comp_ellint_3f;
using std::comp_ellint_3l;
using std::cyl_bessel_i;
using std::cyl_bessel_if;
using std::cyl_bessel_il;
using std::cyl_bessel_j;
using std::cyl_bessel_jf;
using std::cyl_bessel_jl;
using std::cyl_bessel_k;
using std::cyl_bessel_kf;
using std::cyl_bessel_kl;
using std::cyl_neumann;
using std::cyl_neumannf;
using std::cyl_neumannl;
using std::ellint_1;
using std::ellint_1f;
using std::ellint_1l;
using std::ellint_2;
using std::ellint_2f;
using std::ellint_2l;
using std::ellint_3;
using std::ellint_3f;
using std::ellint_3l;
using std::expint;
using std::expintf;
using std::expintl;
using std::hermite;
using std::hermitef;
using std::hermitel;
using std::legendre;
using std::legendref;
using std::legendrel;
using std::laguerre;
using std::laguerref;
using std::laguerrel;
using std::riemann_zeta;
using std::riemann_zetaf;
using std::riemann_zetal;
using std::sph_bessel;
using std::sph_besself;
using std::sph_bessell;
using std::sph_legendre;
using std::sph_legendref;
using std::sph_legendrel;
using std::sph_neumann;
using std::sph_neumannf;
using std::sph_neumannl;
#endif
}
// 17.13.3 <csetjmp>
export C_LIB_NAMESPACE
{
using std::jmp_buf;
using std::longjmp;
// setjmp macro not exported
}
// 17.13.4 <csignal>
export C_LIB_NAMESPACE
{
using std::raise;
using std::sig_atomic_t;
using std::signal;
// SIG_* macros not exported
}
// 17.13.2 <cstdarg>
export C_LIB_NAMESPACE
{
using std::va_list;
// va_arg and friend macros not exported
}
// 17.2.1 <cstddef> [cstddef.syn]
export C_LIB_NAMESPACE
{
using std::max_align_t;
using std::nullptr_t;
using std::ptrdiff_t;
using std::size_t;
#ifndef STD_COMPAT
using std::byte;
using std::operator<<=;
using std::operator<<;
using std::operator>>=;
using std::operator>>;
using std::operator|=;
using std::operator|;
using std::operator&=;
using std::operator&;
using std::operator^=;
using std::operator^;
using std::operator~;
using std::to_integer;
#endif
// NULL and offsetof macros not exported
}
// 17.4 <cstdint>
export C_LIB_NAMESPACE
{
using std::int8_t;
using std::int16_t;
using std::int32_t;
using std::int64_t;
using std::int_fast16_t;
using std::int_fast32_t;
using std::int_fast64_t;
using std::int_fast8_t;
using std::int_least16_t;
using std::int_least32_t;
using std::int_least64_t;
using std::int_least8_t;
using std::intmax_t;
using std::intptr_t;
using std::uint8_t;
using std::uint16_t;
using std::uint32_t;
using std::uint64_t;
using std::uint_fast16_t;
using std::uint_fast32_t;
using std::uint_fast64_t;
using std::uint_fast8_t;
using std::uint_least16_t;
using std::uint_least32_t;
using std::uint_least64_t;
using std::uint_least8_t;
using std::uintmax_t;
using std::uintptr_t;
}
// 31.13.1 <cstdio>
export C_LIB_NAMESPACE
{
using std::clearerr;
using std::fclose;
using std::feof;
using std::ferror;
using std::fflush;
using std::fgetc;
using std::fgetpos;
using std::fgets;
using std::FILE;
using std::fopen;
using std::fpos_t;
using std::fprintf;
using std::fputc;
using std::fputs;
using std::fread;
using std::freopen;
using std::fscanf;
using std::fseek;
using std::fsetpos;
using std::ftell;
using std::fwrite;
using std::getc;
using std::getchar;
using std::perror;
using std::printf;
using std::putc;
using std::putchar;
using std::puts;
using std::remove;
using std::rename;
using std::rewind;
using std::scanf;
using std::setbuf;
using std::setvbuf;
using std::size_t;
using std::snprintf;
using std::sprintf;
using std::sscanf;
using std::tmpfile;
using std::tmpnam;
using std::ungetc;
using std::vfprintf;
using std::vfscanf;
using std::vprintf;
using std::vscanf;
using std::vsnprintf;
using std::vsprintf;
using std::vsscanf;
}
// 17.2.2 <cstdlib> [cstdlib.syn]
export C_LIB_NAMESPACE
{
using std::_Exit;
using std::abort;
using std::abs;
using std::aligned_alloc;
using std::at_quick_exit;
using std::atexit;
using std::atof;
using std::atoi;
using std::atol;
using std::atoll;
using std::bsearch;
using std::calloc;
using std::div;
using std::div_t;
using std::exit;
using std::free;
using std::getenv;
using std::labs;
using std::ldiv;
using std::ldiv_t;
using std::llabs;
using std::lldiv;
using std::lldiv_t;
using std::malloc;
using std::mblen;
using std::mbstowcs;
using std::mbtowc;
using std::qsort;
using std::quick_exit;
using std::rand;
using std::realloc;
using std::size_t;
using std::srand;
using std::strtod;
using std::strtof;
using std::strtol;
using std::strtold;
using std::strtoll;
using std::strtoul;
using std::strtoull;
using std::system;
using std::wcstombs;
using std::wctomb;
}
// 23.5.3 <cstring>
export C_LIB_NAMESPACE
{
using std::memchr;
using std::memcmp;
using std::memcpy;
using std::memmove;
using std::memset;
using std::size_t;
using std::strcat;
using std::strchr;
using std::strcmp;
using std::strcoll;
using std::strcpy;
using std::strcspn;
using std::strerror;
using std::strlen;
using std::strncat;
using std::strncmp;
using std::strncpy;
using std::strpbrk;
using std::strrchr;
using std::strspn;
using std::strstr;
using std::strtok;
using std::strxfrm;
}
// 29.15 <ctime>
export C_LIB_NAMESPACE
{
using std::asctime;
using std::clock;
using std::clock_t;
using std::ctime;
using std::difftime;
using std::gmtime;
using std::localtime;
using std::mktime;
using std::size_t;
using std::strftime;
using std::time;
using std::time_t;
using std::timespec;
using std::tm;
using std::timespec_get;
}
// 23.5.5 <cuchar>
export C_LIB_NAMESPACE
{
using std::mbrtoc8;
using std::c8rtomb;
using std::mbrtoc16;
using std::c16rtomb;
using std::mbrtoc32;
using std::c32rtomb;
}
// 23.5.4 <cwchar>
export C_LIB_NAMESPACE
{
using std::btowc;
using std::fgetwc;
using std::fgetws;
using std::fputwc;
using std::fputws;
using std::fwide;
using std::fwprintf;
using std::fwscanf;
using std::getwc;
using std::getwchar;
using std::mbrlen;
using std::mbrtowc;
using std::mbsinit;
using std::mbsrtowcs;
using std::mbstate_t;
using std::putwc;
using std::putwchar;
using std::size_t;
using std::swprintf;
using std::swscanf;
using std::tm;
using std::ungetwc;
using std::vfwprintf;
using std::vfwscanf;
using std::vswprintf;
using std::vswscanf;
using std::vwprintf;
using std::vwscanf;
using std::wcrtomb;
using std::wcscat;
using std::wcschr;
using std::wcscmp;
using std::wcscoll;
using std::wcscpy;
using std::wcscspn;
using std::wcsftime;
using std::wcslen;
using std::wcsncat;
using std::wcsncmp;
using std::wcsncpy;
using std::wcspbrk;
using std::wcsrchr;
using std::wcsrtombs;
using std::wcsspn;
using std::wcsstr;
using std::wcstod;
using std::wcstof;
using std::wcstok;
using std::wcstol;
using std::wcstold;
using std::wcstoll;
using std::wcstoul;
using std::wcstoull;
using std::wcsxfrm;
using std::wctob;
using std::wint_t;
using std::wmemchr;
using std::wmemcmp;
using std::wmemcpy;
using std::wmemmove;
using std::wmemset;
using std::wprintf;
using std::wscanf;
}
// 23.5.2 <cwctype>
export C_LIB_NAMESPACE
{
using std::iswalnum;
using std::iswalpha;
using std::iswblank;
using std::iswcntrl;
using std::iswctype;
using std::iswdigit;
using std::iswgraph;
using std::iswlower;
using std::iswprint;
using std::iswpunct;
using std::iswspace;
using std::iswupper;
using std::iswxdigit;
using std::towctrans;
using std::towlower;
using std::towupper;
using std::wctrans;
using std::wctrans_t;
using std::wctype;
using std::wctype_t;
using std::wint_t;
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,29 @@
// -*- C++ -*- [std.modules] module std.compat
// Copyright The GNU Toolchain Authors.
//
// This file is part of the GNU ISO C++ Library. This library is free
// software; you can redistribute it and/or modify it under the
// terms of the GNU General Public License as published by the
// Free Software Foundation; either version 3.
// This library is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
// Under Section 7 of GPL version 3, you are granted additional
// permissions described in the GCC Runtime Library Exception, version
// 3.1, as published by the Free Software Foundation.
// You should have received a copy of the GNU General Public License and
// a copy of the GCC Runtime Library Exception along with this program;
// see the files COPYING3 and COPYING.RUNTIME respectively. If not, see
// <http://www.gnu.org/licenses/>.
export module std.compat;
export import std;
#define STD_COMPAT 1
// C library exports are appended from std-clib.cc.in.