[Developers] patch: make "cctk_WarnLevel.h" includable by Fortran code

Jonathan Thornburg jthorn at aei.mpg.de
Sat May 7 09:23:51 CDT 2005


As of current CVS, "cctk_WarnLevel.h" is a C/C++-only header file,
i.e. it's not valid for Fortran code (either 77 or 90).  In particular,
this means that the warning-level #defines we introduced on 10.Dec.2004
in responce to Cactus bug#1742,

/* suggested values for warning levels (courtesy of Steve, PR#1742) */
#define CCTK_WARN_ABORT    0    /* abort the Cactus run */
#define CCTK_WARN_ALERT    1    /* the results of this run will be wrong, */
                                 /* and this will surprise the user, */
                                 /* but we can still continue the run */
#define CCTK_WARN_COMPLAIN 2    /* the user should know about this, */
                                 /* but the this problem is not terribly */
                                 /* surprising */
#define CCTK_WARN_PICKY    3    /* this is for small problems that can */
                                 /* probably be ignored, but that careful */
                                 /* people may want to know about */
#define CCTK_WARN_DEBUG    4    /* these messages are probably useful */
                                 /* only for debugging purposes */

are not available to Fortran code.

I propose that we change this (making these defines available to Fortran
as well as C/C++), by applying the enclosed patch.

This would change 2 flesh header files in  src/include/ :
* cctk.h would be changed to #include "cctk_WarnLevel.h" for Fortran
   as well as for C/C++
* cctk_WarnLevel.h would be changed so it could safely be #included
   from Fortran (as well as still from C/C++, of course), by guarding
   C/C++-only constructs with  #ifdef CCODE  ...  #endif .

[I had thought we had already made this change, and in fact I was the
one who (also on 10.Dec.2004) changed the Fortran example for CCTK_WARN()
in the Cactus Reference Manual to use CCTK_WARN_ABORT.  Hence my surprise
to discover that this gives a syntax error because CCTK_WARN_ABORT isn't
(yet) defined for Fortran code, and hence this patch proposal.....]

ciao,

-- 
-- Jonathan Thornburg <jthorn at aei.mpg.de>
    Max-Planck-Institut fuer Gravitationsphysik (Albert-Einstein-Institut),
    Golm, Germany, "Old Europe"     http://www.aei.mpg.de/~jthorn/home.html
    "Washing one's hands of the conflict between the powerful and the
     powerless means to side with the powerful, not to be neutral."
                                       -- quote by Freire / poster by Oxfam
-------------- next part --------------
Index: cctk.h
===================================================================
RCS file: /cactusdevcvs/Cactus/src/include/cctk.h,v
retrieving revision 1.90
diff -u -r1.90 cctk.h
--- cctk.h	18 Feb 2005 09:58:31 -0000	1.90
+++ cctk.h	7 May 2005 14:12:46 -0000
@@ -28,6 +28,7 @@
 
 #include "cctk_Faces.h"
 #include "cctk_Interp.h"
+#include "cctk_WarnLevel.h"
 
 #define CCTK_PRINTSEPARATOR\
   print '("--------------------------------------------------------------------------------")'
Index: cctk_WarnLevel.h
===================================================================
RCS file: /cactusdevcvs/Cactus/src/include/cctk_WarnLevel.h,v
retrieving revision 1.12
diff -u -r1.12 cctk_WarnLevel.h
--- cctk_WarnLevel.h	7 Feb 2005 14:08:43 -0000	1.12
+++ cctk_WarnLevel.h	7 May 2005 14:12:46 -0000
@@ -11,6 +11,8 @@
 #ifndef _CCTK_WARNLEVEL_H_
 #define _CCTK_WARNLEVEL_H_
 
+#ifdef CCODE
+
 #ifdef __cplusplus 
 extern "C" 
 {
@@ -49,6 +51,8 @@
 }
 #endif
 
+#endif	/* CCODE */
+
 /* suggested values for warning levels (courtesy of Steve, PR#1742) */
 #define CCTK_WARN_ABORT    0	/* abort the Cactus run */
 #define CCTK_WARN_ALERT    1	/* the results of this run will be wrong, */
@@ -63,4 +67,4 @@
 #define CCTK_WARN_DEBUG    4	/* these messages are probably useful */
 				/* only for debugging purposes */
 
-#endif
+#endif	/* ! _CCTK_WARNLEVEL_H_ */


More information about the Developers mailing list