Created
April 12, 2020 04:48
-
-
Save mikdusan/4c0728cec0e25db705b2e293170e7b3a to your computer and use it in GitHub Desktop.
andrew's c++ / stdc++ patch
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/codegen.cpp b/src/codegen.cpp | |
index 5214d49a3..23ab2a130 100644 | |
--- a/src/codegen.cpp | |
+++ b/src/codegen.cpp | |
@@ -9252,6 +9252,9 @@ void add_cc_args(CodeGen *g, ZigList<const char *> &args, const char *out_dep_pa | |
} | |
args.append("-nostdinc"); | |
+ if (source_kind == FileExtCpp) { | |
+ args.append("-nostdinc++"); | |
+ } | |
args.append("-fno-spell-checking"); | |
if (g->function_sections) { | |
diff --git a/src/main.cpp b/src/main.cpp | |
index 8805382f3..b682aa69b 100644 | |
--- a/src/main.cpp | |
+++ b/src/main.cpp | |
@@ -632,11 +632,17 @@ static int main0(int argc, char **argv) { | |
break; | |
} | |
case Stage2ClangArgL: // -l | |
- if (strcmp(it.only_arg, "c") == 0) | |
+ if (strcmp(it.only_arg, "c") == 0) { | |
have_libc = true; | |
- if (strcmp(it.only_arg, "c++") == 0) | |
+ link_libs.append("c"); | |
+ } else if (strcmp(it.only_arg, "c++") == 0 || | |
+ strcmp(it.only_arg, "stdc++") == 0) | |
+ { | |
have_libcpp = true; | |
- link_libs.append(it.only_arg); | |
+ link_libs.append("c++"); | |
+ } else { | |
+ link_libs.append(it.only_arg); | |
+ } | |
break; | |
case Stage2ClangArgIgnore: | |
break; | |
@@ -1016,11 +1022,15 @@ static int main0(int argc, char **argv) { | |
} else if (arg[1] == 'l' && arg[2] != 0) { | |
// alias for --library | |
const char *l = &arg[2]; | |
- if (strcmp(l, "c") == 0) | |
+ if (strcmp(l, "c") == 0) { | |
have_libc = true; | |
- if (strcmp(l, "c++") == 0) | |
+ link_libs.append("c"); | |
+ } else if (strcmp(l, "c++") == 0 || strcmp(l, "stdc++") == 0) { | |
have_libcpp = true; | |
- link_libs.append(l); | |
+ link_libs.append("c++"); | |
+ } else { | |
+ link_libs.append(l); | |
+ } | |
} else if (arg[1] == 'I' && arg[2] != 0) { | |
clang_argv.append("-I"); | |
clang_argv.append(&arg[2]); | |
@@ -1159,11 +1169,15 @@ static int main0(int argc, char **argv) { | |
} else if (strcmp(arg, "-F") == 0) { | |
framework_dirs.append(argv[i]); | |
} else if (strcmp(arg, "--library") == 0 || strcmp(arg, "-l") == 0) { | |
- if (strcmp(argv[i], "c") == 0) | |
+ if (strcmp(argv[i], "c") == 0) { | |
have_libc = true; | |
- if (strcmp(argv[i], "c++") == 0) | |
+ link_libs.append("c"); | |
+ } else if (strcmp(argv[i], "c++") == 0 || strcmp(argv[i], "stdc++") == 0) { | |
have_libcpp = true; | |
- link_libs.append(argv[i]); | |
+ link_libs.append("c++"); | |
+ } else { | |
+ link_libs.append(argv[i]); | |
+ } | |
} else if (strcmp(arg, "--forbid-library") == 0) { | |
forbidden_link_libs.append(argv[i]); | |
} else if (strcmp(arg, "--object") == 0) { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
put conditional around
-nostdinc++
to avoid following warnings: