Message ID | 55A6ACB2.5080501@acm.org |
---|---|
State | New |
Headers | show |
On 07/15/2015 08:55 PM, Nathan Sidwell wrote: > I've applied this obvious patch to trunk to make mkoffloads work for > C++. The equivalent is already on the gomp4 branch. Not really objecting, but why is this necessary? We control how to compile the file generated by mkoffload, so we can just use the C compiler - do you foresee using C++ features in there? Bernd
On 07/15/15 20:55, Bernd Schmidt wrote: > On 07/15/2015 08:55 PM, Nathan Sidwell wrote: >> I've applied this obvious patch to trunk to make mkoffloads work for >> C++. The equivalent is already on the gomp4 branch. > > Not really objecting, but why is this necessary? We control how to compile the > file generated by mkoffload, so we can just use the C compiler - do you foresee > using C++ features in there? It caused tests to fail -- apparently we invoke the C++ compiler when the original file was C++. As I said, this matches the gomp4 branch behavior, and happens to match the intelmic behaviour. nathan
2015-07-15 Nathan Sidwell <nathan@codesourcery.com> * config/nvptx/mkoffload.c (process): Add C++ protection to emitted code. Index: config/nvptx/mkoffload.c =================================================================== --- config/nvptx/mkoffload.c (revision 225843) +++ config/nvptx/mkoffload.c (working copy) @@ -867,7 +867,13 @@ process (FILE *in, FILE *out) "func_mappings\n", nvars, nfuncs); fprintf (out, "};\n\n"); - fprintf (out, "extern void GOMP_offload_register (const void *, int, void *);\n"); + fprintf (out, "#ifdef __cplusplus\n" + "extern \"C\" {\n" + "#endif\n"); + fprintf (out, "extern void GOMP_offload_register (void *, int, void *);\n"); + fprintf (out, "#ifdef __cplusplus\n" + "}\n" + "#endif\n"); fprintf (out, "extern void *__OFFLOAD_TABLE__[];\n\n"); fprintf (out, "static __attribute__((constructor)) void init (void)\n{\n");