mkoffload.c (process): Add C++ protection to emitted code.
authorNathan Sidwell <nathan@codesourcery.com>
Wed, 15 Jul 2015 18:54:18 +0000 (18:54 +0000)
committerNathan Sidwell <nathan@gcc.gnu.org>
Wed, 15 Jul 2015 18:54:18 +0000 (18:54 +0000)
* config/nvptx/mkoffload.c (process): Add C++ protection to
emitted code.

From-SVN: r225844

gcc/ChangeLog
gcc/config/nvptx/mkoffload.c

index beea890e672d58da4fe5f96d87efe292ac2a9f94..f05f82ece79106fbce4f9fcdc5fc6d26ffec1087 100644 (file)
@@ -1,3 +1,8 @@
+2015-07-15  Nathan Sidwell  <nathan@codesourcery.com>
+
+       * config/nvptx/mkoffload.c (process): Add C++ protection to
+       emitted code.
+
 2015-07-14  Michael Meissner  <meissner@linux.vnet.ibm.com>
 
        PR target/66854
index 8bc08bfeaeb15af2757f45b8a0c5b9ec23e06a38..42cce3b7e07ed8dd5002d381e9dbc621367f91dd 100644 (file)
@@ -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");