From f63c17760fab6fbf56ba500f7a8c746aa15b34a4 Mon Sep 17 00:00:00 2001 From: Pedro Alves Date: Thu, 12 Feb 2015 09:59:03 +0000 Subject: [PATCH] Wrap a few opcodes headers in extern "C" for C++ These are sufficient to link an --enable-targets=all GDB build in C++ mode, on x86_64 Fedora 20. include/opcode/ 2015-02-19 Pedro Alves * cgen.h [__cplusplus]: Wrap in extern "C". * msp430-decode.h [__cplusplus]: Likewise. * nios2.h [__cplusplus]: Likewise. * rl78.h [__cplusplus]: Likewise. * rx.h [__cplusplus]: Likewise. * tilegx.h [__cplusplus]: Likewise. opcodes/ 2015-02-19 Pedro Alves * microblaze-dis.h [__cplusplus]: Wrap in extern "C". --- include/opcode/ChangeLog | 9 +++++++++ include/opcode/cgen.h | 8 ++++++++ include/opcode/msp430-decode.h | 8 ++++++++ include/opcode/nios2.h | 8 ++++++++ include/opcode/rl78.h | 8 ++++++++ include/opcode/rx.h | 8 ++++++++ include/opcode/tilegx.h | 8 ++++++++ opcodes/ChangeLog | 4 ++++ opcodes/microblaze-dis.h | 8 ++++++++ 9 files changed, 69 insertions(+) diff --git a/include/opcode/ChangeLog b/include/opcode/ChangeLog index 52fd46210c..36bc33521f 100644 --- a/include/opcode/ChangeLog +++ b/include/opcode/ChangeLog @@ -1,3 +1,12 @@ +2015-02-19 Pedro Alves + + * cgen.h [__cplusplus]: Wrap in extern "C". + * msp430-decode.h [__cplusplus]: Likewise. + * nios2.h [__cplusplus]: Likewise. + * rl78.h [__cplusplus]: Likewise. + * rx.h [__cplusplus]: Likewise. + * tilegx.h [__cplusplus]: Likewise. + 2015-01-28 James Bowman * ft32.h: New file. diff --git a/include/opcode/cgen.h b/include/opcode/cgen.h index a23f0fdb00..0efbe790b6 100644 --- a/include/opcode/cgen.h +++ b/include/opcode/cgen.h @@ -27,6 +27,10 @@ /* ??? IWBN to replace bfd in the name. */ #include "bfd_stdint.h" +#ifdef __cplusplus +extern "C" { +#endif + /* ??? This file requires bfd.h but only to get bfd_vma. Seems like an awful lot to require just to get such a fundamental type. Perhaps the definition of bfd_vma can be moved outside of bfd.h. @@ -1476,4 +1480,8 @@ extern void cgen_clear_signed_overflow_ok (CGEN_CPU_DESC); /* Will an error message be generated if a signed field in an instruction overflows ? */ extern unsigned int cgen_signed_overflow_ok_p (CGEN_CPU_DESC); +#ifdef __cplusplus +} +#endif + #endif /* OPCODE_CGEN_H */ diff --git a/include/opcode/msp430-decode.h b/include/opcode/msp430-decode.h index 3960278480..3edd3f2b01 100644 --- a/include/opcode/msp430-decode.h +++ b/include/opcode/msp430-decode.h @@ -19,6 +19,10 @@ Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA 02110-1301, USA. */ +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { MSO_unknown, @@ -128,3 +132,7 @@ typedef struct } MSP430_Opcode_Decoded; int msp430_decode_opcode (unsigned long, MSP430_Opcode_Decoded *, int (*)(void *), void *); + +#ifdef __cplusplus +} +#endif diff --git a/include/opcode/nios2.h b/include/opcode/nios2.h index 44dffb7084..cbd2b8ccb4 100644 --- a/include/opcode/nios2.h +++ b/include/opcode/nios2.h @@ -25,6 +25,10 @@ #include "bfd.h" +#ifdef __cplusplus +extern "C" { +#endif + /**************************************************************************** * This file contains structures, bit masks and shift counts used * by the GNU toolchain to define the Nios II instruction set and @@ -153,4 +157,8 @@ extern int nios2_num_regs; extern const struct nios2_opcode * nios2_find_opcode_hash (unsigned long, unsigned long); +#ifdef __cplusplus +} +#endif + #endif /* _NIOS2_H */ diff --git a/include/opcode/rl78.h b/include/opcode/rl78.h index 5495c4cbf2..72adf14326 100644 --- a/include/opcode/rl78.h +++ b/include/opcode/rl78.h @@ -26,6 +26,10 @@ #ifndef RL78_OPCODES_H_INCLUDED #define RL78_OPCODES_H_INCLUDED +#ifdef __cplusplus +extern "C" { +#endif + /* For the purposes of these structures, the RL78 registers are as follows, despite most of these being memory-mapped and bank-switched: */ @@ -164,4 +168,8 @@ typedef struct int rl78_decode_opcode (unsigned long, RL78_Opcode_Decoded *, int (*)(void *), void *); +#ifdef __cplusplus +} +#endif + #endif diff --git a/include/opcode/rx.h b/include/opcode/rx.h index e4fe05deeb..41557b2f8c 100644 --- a/include/opcode/rx.h +++ b/include/opcode/rx.h @@ -23,6 +23,10 @@ analyzer, and the disassembler. Given an opcode data source, it decodes the next opcode into the following structures. */ +#ifdef __cplusplus +extern "C" { +#endif + typedef enum { RX_AnySize = 0, @@ -212,3 +216,7 @@ typedef struct registers. 32..47 are condition codes. */ int rx_decode_opcode (unsigned long, RX_Opcode_Decoded *, int (*)(void *), void *); + +#ifdef __cplusplus +} +#endif diff --git a/include/opcode/tilegx.h b/include/opcode/tilegx.h index e0d8aee9bb..ae8f95bd93 100644 --- a/include/opcode/tilegx.h +++ b/include/opcode/tilegx.h @@ -21,6 +21,10 @@ #ifndef opcode_tile_h #define opcode_tile_h +#ifdef __cplusplus +extern "C" { +#endif + typedef unsigned long long tilegx_bundle_bits; @@ -1301,4 +1305,8 @@ typedef tilegx_bundle_bits tile_bundle_bits; #define TILE_LOG2_BUNDLE_ALIGNMENT_IN_BYTES \ TILEGX_LOG2_BUNDLE_ALIGNMENT_IN_BYTES +#ifdef __cplusplus +} +#endif + #endif /* opcode_tilegx_h */ diff --git a/opcodes/ChangeLog b/opcodes/ChangeLog index b400f5b69e..ddb04b8843 100644 --- a/opcodes/ChangeLog +++ b/opcodes/ChangeLog @@ -1,3 +1,7 @@ +2015-02-19 Pedro Alves + + * microblaze-dis.h [__cplusplus]: Wrap in extern "C". + 2015-02-10 Pedro Alves Tom Tromey diff --git a/opcodes/microblaze-dis.h b/opcodes/microblaze-dis.h index a837adace1..fd09745e0e 100644 --- a/opcodes/microblaze-dis.h +++ b/opcodes/microblaze-dis.h @@ -22,6 +22,10 @@ #ifndef MICROBLAZE_DIS_H #define MICROBLAZE_DIS_H 1 +#ifdef __cplusplus +extern "C" { +#endif + extern enum microblaze_instr microblaze_decode_insn (long, int *, int *, int *, int *); extern unsigned long microblaze_get_target_address (long, bfd_boolean, int, @@ -31,4 +35,8 @@ extern enum microblaze_instr get_insn_microblaze (long, bfd_boolean *, enum microblaze_instr_type *, short *); +#ifdef __cplusplus +} +#endif + #endif /* microblaze-dis.h */ -- 2.34.1