From 6ca6fea54ca0e3c02c6cebb9ad48e1affcf683ae Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Tue, 30 Sep 2025 11:35:51 +0200 Subject: [PATCH 01/14] true by default --- docs/mrdocs.schema.json | 4 ++-- src/lib/ConfigOptions.json | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/mrdocs.schema.json b/docs/mrdocs.schema.json index 8865cd48f..ff800a73e 100644 --- a/docs/mrdocs.schema.json +++ b/docs/mrdocs.schema.json @@ -547,7 +547,7 @@ "type": "string" }, "use-system-libc": { - "default": false, + "default": true, "description": "To achieve reproducible results, MrDocs bundles the LibC headers with its definitions. To use the C standard library available in the system instead, set this option to true.", "enum": [ true, @@ -557,7 +557,7 @@ "type": "boolean" }, "use-system-stdlib": { - "default": false, + "default": true, "description": "To achieve reproducible results, MrDocs bundles the LibC++ headers. To use the C++ standard library available in the system instead, set this option to true.", "enum": [ true, diff --git a/src/lib/ConfigOptions.json b/src/lib/ConfigOptions.json index a75281f17..87b070c1c 100644 --- a/src/lib/ConfigOptions.json +++ b/src/lib/ConfigOptions.json @@ -486,7 +486,7 @@ "brief": "Use the system C++ standard library", "details": "To achieve reproducible results, MrDocs bundles the LibC++ headers. To use the C++ standard library available in the system instead, set this option to true.", "type": "bool", - "default": false + "default": true }, { "name": "stdlib-includes", @@ -506,7 +506,7 @@ "brief": "Use the system C standard library", "details": "To achieve reproducible results, MrDocs bundles the LibC headers with its definitions. To use the C standard library available in the system instead, set this option to true.", "type": "bool", - "default": false + "default": true }, { "name": "libc-includes", From 5971dabc5d96769c75d7f745e9cf0335a2992a73 Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Tue, 30 Sep 2025 11:36:03 +0200 Subject: [PATCH 02/14] adjust --- util/generate-config-info.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/generate-config-info.py b/util/generate-config-info.py index ba68423e9..a264bf475 100644 --- a/util/generate-config-info.py +++ b/util/generate-config-info.py @@ -1349,7 +1349,7 @@ def generate_config_info_inc(config): def generate_header_comment(): header_comment = '/*\n' header_comment += ' * This file is generated automatically from the json file\n' - header_comment += ' * `src/lib/Lib/ConfigOptions.json`. Do not edit this file\n' + header_comment += ' * `src/lib/ConfigOptions.json`. Do not edit this file\n' header_comment += ' * manually. Instead, edit the json file and run the script\n' header_comment += ' * `util/generate-config-info.py` to regenerate this file.\n' header_comment += ' */\n\n' From 77e2b7b39b7f0214fe3d2f3535cd5b468e3cadff Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Tue, 30 Sep 2025 11:42:55 +0200 Subject: [PATCH 03/14] docs --- docs/modules/ROOT/pages/usage.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/modules/ROOT/pages/usage.adoc b/docs/modules/ROOT/pages/usage.adoc index 473aa4297..12eed3623 100644 --- a/docs/modules/ROOT/pages/usage.adoc +++ b/docs/modules/ROOT/pages/usage.adoc @@ -278,7 +278,7 @@ It's also common for libraries to depend on the C++ standard library, the C stan That means unless `-nostdinc` is defined, all systems include paths are included. This is what allows the user to also use headers like `` or `` without explicitly including anything else, even though they are not part of the C standard library. This is often seen as a convenience but can lead to portability issues. -In this context, MrDocs provides the `use-system-stdlib` and `use-system-libc` options. Both are set as `false` by default, meaning MrDocs will compile the code as if the `-nostdinc++ -nostdlib++` and `-nostdinc` flags were passed to Clang. Additionally: +In this context, MrDocs provides the `use-system-stdlib` and `use-system-libc` options. Both are set as `true` by default; setting both to `false` results in MrDocs compiling the code as if the `-nostdinc++ -nostdlib++` and `-nostdinc` flags were passed to Clang. Additionally: - When `use-system-stdlib` is `false`, MrDocs will use the bundled libc++ headers available in `/share/mrdocs/headers/libcxx` and `/share/mrdocs/headers/clang`. These paths can be adjusted with the `stdlib-includes` option. - When `use-system-libc` is `false`, MrDocs will use the bundled libc stubs available in `/share/mrdocs/headers/libc-stubs`. This path can be adjusted with the `libc-includes` option. From 1936f368d5fad60dd09767b7668fc3a14914666c Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Tue, 30 Sep 2025 11:46:16 +0200 Subject: [PATCH 04/14] explicit --- test-files/golden-tests/core/libcxx.yml | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 test-files/golden-tests/core/libcxx.yml diff --git a/test-files/golden-tests/core/libcxx.yml b/test-files/golden-tests/core/libcxx.yml new file mode 100644 index 000000000..e0d87cc88 --- /dev/null +++ b/test-files/golden-tests/core/libcxx.yml @@ -0,0 +1,2 @@ +use-system-stdlib: false +use-system-libc: false \ No newline at end of file From 54143599928c54f6882b874e934019f5ef1d5717 Mon Sep 17 00:00:00 2001 From: Agustin Berge Date: Tue, 30 Sep 2025 11:50:02 +0200 Subject: [PATCH 05/14] std --- .../golden-tests/symbols/function/sfinae.cpp | 28 +++++++++++++-- .../golden-tests/symbols/function/sfinae.xml | 34 +++++++++---------- .../golden-tests/symbols/function/sfinae.yml | 2 ++ 3 files changed, 45 insertions(+), 19 deletions(-) diff --git a/test-files/golden-tests/symbols/function/sfinae.cpp b/test-files/golden-tests/symbols/function/sfinae.cpp index c160b568e..2268505bd 100644 --- a/test-files/golden-tests/symbols/function/sfinae.cpp +++ b/test-files/golden-tests/symbols/function/sfinae.cpp @@ -1,5 +1,29 @@ -#include -#include +namespace std +{ +template +struct enable_if +{ + using type = T; +}; +template +struct enable_if +{}; + +template +using enable_if_t = typename enable_if::type; + +template +using void_t = void; + +template +struct is_integral +{ + static constexpr bool value = true; +}; + +template +bool is_integral_v = is_integral::value; +} /// Enabled via return type template diff --git a/test-files/golden-tests/symbols/function/sfinae.xml b/test-files/golden-tests/symbols/function/sfinae.xml index f700f559b..a1e2765ca 100644 --- a/test-files/golden-tests/symbols/function/sfinae.xml +++ b/test-files/golden-tests/symbols/function/sfinae.xml @@ -4,7 +4,7 @@ - + ::f3 @@ -16,7 +16,7 @@ - + The partial specialization of A is enabled via a template parameter @@ -28,7 +28,7 @@ - + Specialization for integral types @@ -40,14 +40,14 @@ - + SFINAE with std::void_t - + @@ -61,14 +61,14 @@ - + SFINAE with std::void_t - + @@ -80,7 +80,7 @@