Created
December 10, 2022 10:11
-
-
Save iains/392ac23e0101297faf14b6d5e9020a95 to your computer and use it in GitHub Desktop.
allow 'extern "C" ' coroutines.
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/gcc/cp/coroutines.cc b/gcc/cp/coroutines.cc | |
index 3f23317a315..c1a0d6c2283 100644 | |
--- a/gcc/cp/coroutines.cc | |
+++ b/gcc/cp/coroutines.cc | |
@@ -32,6 +32,7 @@ along with GCC; see the file COPYING3. If not see | |
#include "tree.h" | |
#include "gcc-rich-location.h" | |
#include "hash-map.h" | |
+#include "cgraph.h" | |
static bool coro_promise_type_found_p (tree, location_t); | |
@@ -4060,6 +4061,17 @@ coro_build_actor_or_destroy_function (tree orig, tree fn_type, | |
else | |
info->destroy_decl = fn; | |
} | |
+ /* If the function is extern "C" the mangler will not be called. */ | |
+ if (DECL_EXTERN_C_P (orig)) | |
+ { | |
+ /* clone_function_name () picks up the name from DECL_ASSEMBLER_NAME | |
+ which is not yet set here. */ | |
+ SET_DECL_ASSEMBLER_NAME (fn, DECL_NAME (orig)); | |
+ if (actor_p) | |
+ SET_DECL_ASSEMBLER_NAME (fn, clone_function_name (fn, "actor")); | |
+ else | |
+ SET_DECL_ASSEMBLER_NAME (fn, clone_function_name (fn, "destroy")); | |
+ } | |
return fn; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
just because one can do something ... does not mean one should (I'm still not exactly sure about when this would be useful and whether it was intended in the design - question to core to follow).