This is the mail archive of the
cgen@sourceware.org
mailing list for the CGEN project.
some simple patches
- From: Trevor Saunders <tbsaunde at tbsaunde dot org>
- To: cgen at sourceware dot org
- Date: Mon, 18 Jul 2016 02:24:19 -0400
- Subject: some simple patches
- Authentication-results: sourceware.org; auth=none
Hi,
Here's a patch to wrap generated headers in extern "C" so C++ code can
use them as well as C. While I was in the area I fixed the copy right
years in the template so that running cgen for binutils-gdb.git produces
the same thing as is checked in.
I checked the resulting generated code for binutils-gdb.git builds fine
with this. Is it ok? can someone apply it for me please?
Thanks!
Trev
Index: src/cgen/desc-cpu.scm
===================================================================
RCS file: /cvs/src/src/cgen/desc-cpu.scm,v
retrieving revision 1.33
diff -u -r1.33 desc-cpu.scm
--- src/cgen/desc-cpu.scm 13 Feb 2010 03:39:15 -0000 1.33
+++ src/cgen/desc-cpu.scm 18 Jul 2016 06:10:50 -0000
@@ -964,6 +964,10 @@
#ifndef @ARCH@_CPU_H
#define @ARCH@_CPU_H
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
"
/gen-hash-defines
; This is defined in arch.h. It's not defined here as there is yet to
@@ -1004,6 +1008,10 @@
""))
"
+ #ifdef __cplusplus
+ }
+ #endif
+
#endif /* @ARCH@_CPU_H */
"
)
Index: src/cgen/opc-itab.scm
===================================================================
RCS file: /cvs/src/src/cgen/opc-itab.scm,v
retrieving revision 1.19
diff -u -r1.19 opc-itab.scm
--- src/cgen/opc-itab.scm 14 Apr 2016 15:27:54 -0000 1.19
+++ src/cgen/opc-itab.scm 18 Jul 2016 06:10:50 -0000
@@ -701,6 +701,10 @@
#ifndef @ARCH@_OPC_H
#define @ARCH@_OPC_H
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
"
(lambda () (gen-extra-opc.h (opc-file-path) (current-arch-name)))
/gen-insn-enum
@@ -708,6 +712,10 @@
/gen-init-macros
"
+ #ifdef __cplusplus
+ }
+ #endif
+
#endif /* @ARCH@_OPC_H */
"
)
Index: src/cgen/utils.scm
===================================================================
RCS file: /cvs/src/src/cgen/utils.scm,v
retrieving revision 1.38
diff -u -r1.38 utils.scm
--- src/cgen/utils.scm 2 Jan 2010 17:53:10 -0000 1.38
+++ src/cgen/utils.scm 18 Jul 2016 06:10:50 -0000
@@ -1310,7 +1310,7 @@
(cons "\
THIS FILE IS MACHINE GENERATED WITH CGEN.
-Copyright 1996-2010 Free Software Foundation, Inc.
+Copyright (C) 1996-2016 Free Software Foundation, Inc.
"
"\
This file is free software; you can redistribute it and/or modify