From cb5a1fdb849b82aba9f9aa727790d656349396a0 Mon Sep 17 00:00:00 2001 From: tradke Date: Mon, 6 Jan 2003 21:44:40 +0000 Subject: Get rid of macro recursions when declaring prototypes of CCTK_COMPLEX routines. This fixes known problems with cpp on some platforms (Solaris, Darwin) when preprocessing source code which includes this header file. This closes PR Cactus-1354 and CactusPUGH-1167. git-svn-id: http://svn.cactuscode.org/flesh/trunk@3073 17b73243-c579-4c4c-a9d2-2d5706c11dac --- src/include/cctk_Complex.h | 64 ++++++++++++++++++++++++---------------------- 1 file changed, 33 insertions(+), 31 deletions(-) diff --git a/src/include/cctk_Complex.h b/src/include/cctk_Complex.h index 9ff4842a..52094a27 100644 --- a/src/include/cctk_Complex.h +++ b/src/include/cctk_Complex.h @@ -2,27 +2,21 @@ @header cctk_Complex.h @date Tue Dec 14 12:28:05 1999 @author Tom Goodale - @desc - Prototypes for complex numbers. - @enddesc - @version $Header$ + @desc + Prototypes for complex numbers. + @enddesc + @version $Header$ @@*/ #ifndef _CCTK_COMPLEX_H_ #define _CCTK_COMPLEX_H_ #ifdef __cplusplus -extern "C" +extern "C" { #endif -/* a macro which expands to nothing */ -#ifdef NOTHING -#undef NOTHING -#endif -#define NOTHING - /* macro to declare a set of complex functions for a given precision */ #define DECLARE_CMPLX_FUNCTIONS(CCTK_Cmplx, cctk_real, cctk_complex) \ cctk_complex CCTK_Cmplx (cctk_real Re, cctk_real Im); \ @@ -54,31 +48,39 @@ DECLARE_CMPLX_FUNCTIONS (CCTK_Cmplx32, CCTK_REAL16, CCTK_COMPLEX32) #endif -/* get the default precision for complex numbers */ +/* declare the default precision complex functions as #define'd macros */ #ifdef CCTK_REAL_PRECISION_4 -#define CCTK_COMPLEX_PRECISION 8 +#define CCTK_Cmplx CCTK_Cmplx8 +#define CCTK_CmplxReal CCTK_Cmplx8Real +#define CCTK_CmplxImag CCTK_Cmplx8Imag +#define CCTK_CmplxConjg CCTK_Cmplx8Conjg +#define CCTK_CmplxAbs CCTK_Cmplx8Abs +#define CCTK_CmplxAdd CCTK_Cmplx8Add +#define CCTK_CmplxSub CCTK_Cmplx8Sub +#define CCTK_CmplxMul CCTK_Cmplx8Mul +#define CCTK_CmplxDiv CCTK_Cmplx8Div #elif CCTK_REAL_PRECISION_8 -#define CCTK_COMPLEX_PRECISION 16 +#define CCTK_Cmplx CCTK_Cmplx16 +#define CCTK_CmplxReal CCTK_Cmplx16Real +#define CCTK_CmplxImag CCTK_Cmplx16Imag +#define CCTK_CmplxConjg CCTK_Cmplx16Conjg +#define CCTK_CmplxAbs CCTK_Cmplx16Abs +#define CCTK_CmplxAdd CCTK_Cmplx16Add +#define CCTK_CmplxSub CCTK_Cmplx16Sub +#define CCTK_CmplxMul CCTK_Cmplx16Mul +#define CCTK_CmplxDiv CCTK_Cmplx16Div #elif CCTK_REAL_PRECISION_16 -#define CCTK_COMPLEX_PRECISION 32 +#define CCTK_Cmplx CCTK_Cmplx32 +#define CCTK_CmplxReal CCTK_Cmplx32Real +#define CCTK_CmplxImag CCTK_Cmplx32Imag +#define CCTK_CmplxConjg CCTK_Cmplx32Conjg +#define CCTK_CmplxAbs CCTK_Cmplx32Abs +#define CCTK_CmplxAdd CCTK_Cmplx32Add +#define CCTK_CmplxSub CCTK_Cmplx32Sub +#define CCTK_CmplxMul CCTK_Cmplx32Mul +#define CCTK_CmplxDiv CCTK_Cmplx32Div #endif -/* finally declare the default precision complex functions */ -#define CCTK_Cmplx CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, NOTHING) -#define CCTK_CmplxReal CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Real) -#define CCTK_CmplxImag CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Imag) -#define CCTK_CmplxConjg CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Conjg) -#define CCTK_CmplxAbs CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Abs) -#define CCTK_CmplxAdd CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Add) -#define CCTK_CmplxSub CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Sub) -#define CCTK_CmplxMul CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Mul) -#define CCTK_CmplxDiv CCTK_Cmplx_(CCTK_COMPLEX_PRECISION, Div) - -#define CCTK_Cmplx_(precision, function) CCTK_Cmplx__(precision, function) -#define CCTK_Cmplx__(precision, function) CCTK_Cmplx##precision##function - -#undef NOTHING - #ifdef __cplusplus } #endif -- cgit v1.2.3