This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


Earlier I added extern "C" to a bunch of header files in libdecnumber.
Looking into how libdecnumber is used, I see that those files are only
included by one file in gcc, dfp.c.  For simplicity, I removed the
extern "C" from libdecnumber and added it to dfp.c.  To make that
reliable, I changed Makefile.in so that only dfp.o is compiled with the
-I options needed to #include the libdecnumber header files.

Tested with bootstrap on i686-pc-linux-gnu.  Committed to gcc-in-cxx
branch.

Ian

I simply removed the libdecnumber/ChangeLog.cxx, as this patch reverts
the only entry in that file.

gcc/ChangeLog.cxx:

2009-05-26  Ian Lance Taylor  <iant@google.com>

	* dfp.c: If __cplusplus, use extern "C" around inclusion of
	libdecnumber header files.
	* Makefile.in (INCLUDES): Remove $(DECNUMINC).
	(dfp.o): Add separate compilation command using DECNUMINC.


Index: libdecnumber/decRound.h
===================================================================
--- libdecnumber/decRound.h	(revision 147843)
+++ libdecnumber/decRound.h	(working copy)
@@ -27,14 +27,6 @@ see the files COPYING3 and COPYING.RUNTI
 
 #define DFP_INIT_ROUNDMODE(A)  A = __decGetRound()
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 extern void __dfp_set_round (int);
 extern int __dfp_get_round (void);
 extern enum rounding __decGetRound (void);
-
-#ifdef __cplusplus
-}
-#endif
Index: libdecnumber/decNumber.h
===================================================================
--- libdecnumber/decNumber.h	(revision 147843)
+++ libdecnumber/decNumber.h	(working copy)
@@ -108,10 +108,6 @@ 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);
@@ -196,8 +192,4 @@ extern "C" {
 				    && (((dn)->bits&DECSPECIAL)==0))
   #define decNumberRadix(dn)	   (10)
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/decExcept.h
===================================================================
--- libdecnumber/decExcept.h	(revision 147843)
+++ libdecnumber/decExcept.h	(working copy)
@@ -29,14 +29,6 @@ see the files COPYING3 and COPYING.RUNTI
 #define DFP_EXCEPTIONS_ENABLED 1
 #define DFP_HANDLE_EXCEPTIONS(A) __dfp_raise_except(A)
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
 void __dfp_clear_except (void);
 int __dfp_test_except (int);
 void __dfp_raise_except (int);
-
-#ifdef __cplusplus
-}
-#endif
Index: libdecnumber/decDouble.h
===================================================================
--- libdecnumber/decDouble.h	(revision 147843)
+++ libdecnumber/decDouble.h	(working copy)
@@ -67,10 +67,6 @@ see the files COPYING3 and COPYING.RUNTI
 
   #include "decDoubleSymbols.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
   /* Utilities and conversions, extractors, etc.) */
   extern decDouble * decDoubleFromBCD(decDouble *, int32_t, const uint8_t *, int32_t);
   extern decDouble * decDoubleFromInt32(decDouble *, int32_t);
@@ -165,8 +161,4 @@ extern "C" {
   #define decDoubleToNumber(dq, dn) decimal64ToNumber((decimal64 *)(dq), dn)
   #define decDoubleFromNumber(dq, dn, set) decimal64FromNumber((decimal64 *)(dq), dn, set)
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/decSingle.h
===================================================================
--- libdecnumber/decSingle.h	(revision 147843)
+++ libdecnumber/decSingle.h	(working copy)
@@ -65,10 +65,6 @@ see the files COPYING3 and COPYING.RUNTI
 
   #include "decSingleSymbols.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
   /* Utilities (binary argument(s) or result, extractors, etc.) */
   extern decSingle * decSingleFromBCD(decSingle *, int32_t, const uint8_t *, int32_t);
   extern decSingle * decSingleFromPacked(decSingle *, int32_t, const uint8_t *);
@@ -99,8 +95,4 @@ extern "C" {
   #define decSingleToNumber(dq, dn) decimal32ToNumber((decimal32 *)(dq), dn)
   #define decSingleFromNumber(dq, dn, set) decimal32FromNumber((decimal32 *)(dq), dn, set)
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/decContext.h
===================================================================
--- libdecnumber/decContext.h	(revision 147843)
+++ libdecnumber/decContext.h	(working copy)
@@ -245,10 +245,6 @@ 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 *);
@@ -266,8 +262,4 @@ extern "C" {
   extern uint32_t      decContextTestStatus(decContext *, uint32_t);
   extern decContext  * decContextZeroStatus(decContext *);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/decPacked.h
===================================================================
--- libdecnumber/decPacked.h	(revision 147843)
+++ libdecnumber/decPacked.h	(working copy)
@@ -56,18 +56,10 @@ see the files COPYING3 and COPYING.RUNTI
 
   #include "decPackedSymbols.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
   /* Conversions						      */
   uint8_t * decPackedFromNumber(uint8_t *, int32_t, int32_t *,
 				const decNumber *);
   decNumber * decPackedToNumber(const uint8_t *, int32_t, const int32_t *,
 				decNumber *);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/decQuad.h
===================================================================
--- libdecnumber/decQuad.h	(revision 147843)
+++ libdecnumber/decQuad.h	(working copy)
@@ -91,10 +91,6 @@ see the files COPYING3 and COPYING.RUNTI
 
   #include "decQuadSymbols.h"
 
-#ifdef __cplusplus
-extern "C" {
-#endif
-
   /* Utilities and conversions, extractors, etc.) */
   extern decQuad * decQuadFromBCD(decQuad *, int32_t, const uint8_t *, int32_t);
   extern decQuad * decQuadFromInt32(decQuad *, int32_t);
@@ -187,8 +183,4 @@ extern "C" {
   #define decQuadToNumber(dq, dn) decimal128ToNumber((decimal128 *)(dq), dn)
   #define decQuadFromNumber(dq, dn, set) decimal128FromNumber((decimal128 *)(dq), dn, set)
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/dpd/decimal128.h
===================================================================
--- libdecnumber/dpd/decimal128.h	(revision 147843)
+++ libdecnumber/dpd/decimal128.h	(working copy)
@@ -79,10 +79,6 @@ 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 *);
@@ -97,8 +93,4 @@ extern "C" {
   uint32_t    decimal128IsCanonical(const decimal128 *);
   decimal128 * decimal128Canonical(decimal128 *, const decimal128 *);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/dpd/decimal32.h
===================================================================
--- libdecnumber/dpd/decimal32.h	(revision 147843)
+++ libdecnumber/dpd/decimal32.h	(working copy)
@@ -77,10 +77,6 @@ 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 *);
@@ -95,8 +91,4 @@ extern "C" {
   uint32_t    decimal32IsCanonical(const decimal32 *);
   decimal32 * decimal32Canonical(decimal32 *, const decimal32 *);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: libdecnumber/dpd/decimal64.h
===================================================================
--- libdecnumber/dpd/decimal64.h	(revision 147843)
+++ libdecnumber/dpd/decimal64.h	(working copy)
@@ -79,10 +79,6 @@ 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 *);
@@ -97,8 +93,4 @@ extern "C" {
   uint32_t    decimal64IsCanonical(const decimal64 *);
   decimal64 * decimal64Canonical(decimal64 *, const decimal64 *);
 
-#ifdef __cplusplus
-}
-#endif
-
 #endif
Index: gcc/Makefile.in
===================================================================
--- gcc/Makefile.in	(revision 147843)
+++ gcc/Makefile.in	(working copy)
@@ -961,8 +961,7 @@ BUILD_ERRORS = build/errors.o
 # libintl.h will be found in ../intl if we are using the included libintl.
 INCLUDES = -I. -I$(@D) -I$(srcdir) -I$(srcdir)/$(@D) \
 	   -I$(srcdir)/../include @INCINTL@ \
-	   $(CPPINC) $(GMPINC) $(DECNUMINC) \
-	   $(PPLINC) $(CLOOGINC)
+	   $(CPPINC) $(GMPINC) $(PPLINC) $(CLOOGINC)
 
 # [gcc-in-cxx] Keep the .c extension, but compile with C++.
 .c.o:
@@ -2039,6 +2038,11 @@ endif
 	-DDEVPHASE=$(DEVPHASE_s) -DPKGVERSION=$(PKGVERSION_s) \
 	-DBUGURL=$(BUGURL_s) -c $(srcdir)/version.c $(OUTPUT_OPTION)
 
+dfp.o: dfp.c dfp.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)	$(TREE_H) \
+   $(TOPLEV_H) $(TM_P_H) $(REAL_H) $(DECNUM_H)
+	$(CXX) $(ALL_CXXFLAGS) $(ALL_CPPFLAGS) $(DECNUMINC) -c \
+		$(srcdir)/dfp.c $(OUTPUT_OPTION)
+
 gtype-desc.o: gtype-desc.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
 	$(VARRAY_H) $(HASHTAB_H) $(SPLAY_TREE_H) $(OBSTACK_H) $(BITMAP_H) \
 	input.h $(TREE_H) $(RTL_H) $(FUNCTION_H) insn-config.h $(EXPR_H) \
@@ -2602,8 +2606,6 @@ emit-rtl.o : emit-rtl.c $(CONFIG_H) $(SY
    $(REAL_H) $(DF_H)
 real.o : real.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) $(TREE_H) \
    $(TOPLEV_H) $(TM_P_H) $(REAL_H) dfp.h
-dfp.o : dfp.c dfp.h $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H)	$(TREE_H) \
-   $(TOPLEV_H) $(TM_P_H) $(REAL_H) $(DECNUM_H)
 fixed-value.o: fixed-value.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
    $(TREE_H) fixed-value.h $(REAL_H) $(TOPLEV_H)
 integrate.o : integrate.c $(CONFIG_H) $(SYSTEM_H) coretypes.h $(TM_H) \
Index: gcc/dfp.c
===================================================================
--- gcc/dfp.c	(revision 147843)
+++ gcc/dfp.c	(working copy)
@@ -28,6 +28,12 @@ along with GCC; see the file COPYING3.  
 #include "tm_p.h"
 #include "dfp.h"
 
+#ifdef __cplusplus
+/* libdecnumber is always built with a C compiler, not a C++
+   compiler.  */
+extern "C" {
+#endif
+
 /* The order of the following headers is important for making sure
    decNumber structure is large enough to hold decimal128 digits.  */
 
@@ -37,6 +43,10 @@ along with GCC; see the file COPYING3.  
 #include "decimal32.h"
 #include "decNumber.h"
 
+#ifdef __cplusplus
+}
+#endif
+
 #ifndef WORDS_BIGENDIAN
 #define WORDS_BIGENDIAN 0
 #endif

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]