Skip to content

Commit 54c6cff

Browse files
committed
Let -include-std override -import-std
Then users can more easily do `-p -in` -- pure Cpp2 still defaults to using modules, but this way pure Cpp2 can be used without a dependency on modules even on compilers that have modules
1 parent 789cd38 commit 54c6cff

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

source/cppfront.cpp

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,15 +72,15 @@ static auto flag_import_std = false;
7272
static cmdline_processor::register_flag cmd_import_std(
7373
0,
7474
"import-std",
75-
"import the entire C++ standard library via 'import std;'",
75+
"import all std:: via 'import std;' - ignored if -include-std is set",
7676
[]{ flag_import_std = true; }
7777
);
7878

7979
static auto flag_include_std = false;
8080
static cmdline_processor::register_flag cmd_include_std(
8181
0,
8282
"include-std",
83-
"#include the entire C++ standard library - ignored if -import-std is set",
83+
"#include all std:: headers",
8484
[]{ flag_include_std = true; }
8585
);
8686

@@ -1262,15 +1262,18 @@ class cppfront
12621262
if (flag_use_source_location) {
12631263
printer.print_extra( "#define CPP2_USE_SOURCE_LOCATION Yes\n" );
12641264
}
1265-
if (flag_import_std) {
1266-
printer.print_extra( "#define CPP2_IMPORT_STD Yes\n" );
1267-
}
1265+
12681266
if (flag_include_std) {
12691267
printer.print_extra( "#define CPP2_INCLUDE_STD Yes\n" );
12701268
}
1269+
else if (flag_import_std) {
1270+
printer.print_extra( "#define CPP2_IMPORT_STD Yes\n" );
1271+
}
1272+
12711273
if (flag_no_exceptions) {
12721274
printer.print_extra( "#define CPP2_NO_EXCEPTIONS Yes\n" );
12731275
}
1276+
12741277
if (flag_no_rtti) {
12751278
printer.print_extra( "#define CPP2_NO_RTTI Yes\n" );
12761279
}

0 commit comments

Comments
 (0)