gcc-patches@gcc.gnu.org
[Top] [All Lists]

Re: [gcc-in-cxx] Remove extern "C" from libdecnumber

Subject: Re: [gcc-in-cxx] Remove extern "C" from libdecnumber
From: Ian Lance Taylor
Date: Sun, 31 May 2009 21:57:38 -0700
Ben Elliston <bje@xxxxxxxxxxx> writes:

> On Fri, 2009-05-29 at 22:36 -0700, Ian Lance Taylor wrote:
>
>> > We already make local changes to libdecnumber as needed; I don't see a 
>> > particular problem with doing so here, along with sending the fix 
>> > upstream, since it seems clear that the correct fix is adding extern "C" 
>> > to libdecnumber.
>> 
>> OK.  Ben, what is the procedure for sending libdecnumber patches
>> upstream?  (Perhaps we should introduce libdecnumber/README or
>> libdecnumber/README.gcc).
>
> There is not really an upstream--there is no other repository of the
> source code that could receive GPL patches.  For bugs that can be
> described with a test case, we can get those.  For mechanical changes
> like extern "C", just go ahead and commit them locally and I will manage
> them with any future import.

In that case, I'm currently bootstrapping this patch on mainline.  Is
this OK if bootstrap succeeds?  Let me know if you'd like this done
differently in any way.  Note that I only touched the headers which gcc
actually uses.

Ian


2009-05-31  Ian Lance Taylor  <iant@xxxxxxxxxx>

        * decContext.h: Add extern "C" if compiling with C++.
        * decDPD.h: Likewise.
        * decNumber.h: Likewise.
        * dpd/decimal32.h: Likewise.
        * dpd/decimal64.h: Likewise.
        * dpd/decimal128.h: Likewise.


Index: decNumber.h
===================================================================
--- decNumber.h (revision 148020)
+++ decNumber.h (working copy)
@@ -108,6 +108,10 @@ see the files COPYING3 and COPYING.RUNTI
 
   #include "decNumberSymbols.h"
 
+  #ifdef __cplusplus
+  extern "C" {
+  #endif
+
   /* Conversions                                                     */
   decNumber * decNumberFromInt32(decNumber *, int32_t);
   decNumber * decNumberFromUInt32(decNumber *, uint32_t);
@@ -192,4 +196,8 @@ see the files COPYING3 and COPYING.RUNTI
                                    && (((dn)->bits&DECSPECIAL)==0))
   #define decNumberRadix(dn)      (10)
 
+  #ifdef __cplusplus
+  }
+  #endif
+
 #endif
Index: decContext.h
===================================================================
--- decContext.h        (revision 148020)
+++ decContext.h        (working copy)
@@ -245,6 +245,10 @@ see the files COPYING3 and COPYING.RUNTI
 
   #include "decContextSymbols.h"
 
+  #ifdef __cplusplus
+  extern "C" {
+  #endif
+
   extern decContext  * decContextClearStatus(decContext *, uint32_t);
   extern decContext  * decContextDefault(decContext *, int32_t);
   extern enum rounding decContextGetRounding(decContext *);
@@ -262,4 +266,8 @@ see the files COPYING3 and COPYING.RUNTI
   extern uint32_t      decContextTestStatus(decContext *, uint32_t);
   extern decContext  * decContextZeroStatus(decContext *);
 
+  #ifdef __cplusplus
+  }
+  #endif
+
 #endif
Index: dpd/decimal128.h
===================================================================
--- dpd/decimal128.h    (revision 148020)
+++ dpd/decimal128.h    (working copy)
@@ -79,6 +79,10 @@ see the files COPYING3 and COPYING.RUNTI
 
 #include "decimal128Symbols.h"
 
+  #ifdef __cplusplus
+  extern "C" {
+  #endif
+
   /* String conversions                                              */
   decimal128 * decimal128FromString(decimal128 *, const char *, decContext *);
   char * decimal128ToString(const decimal128 *, char *);
@@ -93,4 +97,8 @@ see the files COPYING3 and COPYING.RUNTI
   uint32_t    decimal128IsCanonical(const decimal128 *);
   decimal128 * decimal128Canonical(decimal128 *, const decimal128 *);
 
+  #ifdef __cplusplus
+  }
+  #endif
+
 #endif
Index: dpd/decimal32.h
===================================================================
--- dpd/decimal32.h     (revision 148020)
+++ dpd/decimal32.h     (working copy)
@@ -77,6 +77,10 @@ see the files COPYING3 and COPYING.RUNTI
 
 #include "decimal32Symbols.h"
 
+  #ifdef __cplusplus
+  extern "C" {
+  #endif
+
   /* String conversions                                              */
   decimal32 * decimal32FromString(decimal32 *, const char *, decContext *);
   char * decimal32ToString(const decimal32 *, char *);
@@ -91,4 +95,8 @@ see the files COPYING3 and COPYING.RUNTI
   uint32_t    decimal32IsCanonical(const decimal32 *);
   decimal32 * decimal32Canonical(decimal32 *, const decimal32 *);
 
+  #ifdef __cplusplus
+  }
+  #endif
+
 #endif
Index: dpd/decimal64.h
===================================================================
--- dpd/decimal64.h     (revision 148020)
+++ dpd/decimal64.h     (working copy)
@@ -79,6 +79,10 @@ see the files COPYING3 and COPYING.RUNTI
 
 #include "decimal64Symbols.h"
 
+  #ifdef __cplusplus
+  extern "C" {
+  #endif
+
   /* String conversions                                              */
   decimal64 * decimal64FromString(decimal64 *, const char *, decContext *);
   char * decimal64ToString(const decimal64 *, char *);
@@ -93,4 +97,8 @@ see the files COPYING3 and COPYING.RUNTI
   uint32_t    decimal64IsCanonical(const decimal64 *);
   decimal64 * decimal64Canonical(decimal64 *, const decimal64 *);
 
+  #ifdef __cplusplus
+  }
+  #endif
+
 #endif
Index: decDPD.h
===================================================================
--- decDPD.h    (revision 148020)
+++ decDPD.h    (working copy)
@@ -59,6 +59,10 @@ see the files COPYING3 and COPYING.RUNTI
 #if defined(DEC_BCD2DPD) && DEC_BCD2DPD==1 && !defined(DECBCD2DPD)
 #define DECBCD2DPD
 
+#ifdef __cplusplus
+extern "C" {
+#endif
+
 const uint16_t BCD2DPD[2458]={   0,    1,    2,    3,    4,    5,    6,    7,
     8,   9,    0,    0,    0,    0,    0,    0,   16,   17,   18,   19,   20,
    21,  22,   23,   24,   25,    0,    0,    0,    0,    0,    0,   32,   33,
@@ -1206,5 +1210,9 @@ const uint8_t BIN2BCD8[4000]={
  9,8,1,3, 9,8,2,3, 9,8,3,3, 9,8,4,3, 9,8,5,3, 9,8,6,3, 9,8,7,3, 9,8,8,3, 
9,8,9,3,
  9,9,0,3, 9,9,1,3, 9,9,2,3, 9,9,3,3, 9,9,4,3, 9,9,5,3, 9,9,6,3, 9,9,7,3, 
9,9,8,3,
  9,9,9,3};
+
+#ifdef __cplusplus
+}
 #endif
 
+#endif
<Prev in Thread] Current Thread [Next in Thread>