From e91cde0953119fa01d92174413643e889adbb98e Mon Sep 17 00:00:00 2001 From: eschnett Date: Fri, 26 Oct 2012 14:23:31 +0000 Subject: Use CCTKi_VarDataPtrI in CCTK_DECLARE_ARGUMENTS Introduce new function CCTKi_VarDataPtrI which does not emit warnings. Use it when defining CCTK_DECLARE_ARGUMENTS. git-svn-id: http://svn.cactuscode.org/flesh/trunk@4898 17b73243-c579-4c4c-a9d2-2d5706c11dac --- lib/make/force-rebuild | 1 + lib/sbin/GridFuncStuff.pl | 15 ++++----------- 2 files changed, 5 insertions(+), 11 deletions(-) (limited to 'lib') diff --git a/lib/make/force-rebuild b/lib/make/force-rebuild index b4aece37..7a6a9201 100644 --- a/lib/make/force-rebuild +++ b/lib/make/force-rebuild @@ -39,3 +39,4 @@ 27 Oct 2011: Optimize CCTK_ARGUMENTS for grid functions in Fortran 17 Jun 2012: Correct error in handling optional dependencies 18 Jun 2012: Ticket 768, switch from per thorn define to per thorn include +26 Oct 2012: Use CCTKi_VarDataPtrI instead of CCTK_VarDataPtrI diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index ec25def7..56b1a4ef 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -64,15 +64,8 @@ sub CreateVariableBindings push(@data, '#include "cctk_Types.h"'); push(@data, ''); push(@data, '#ifdef CCODE'); - push(@data, '/* prototype for CCTKi_VarDataPtr() goes here'); - push(@data, ' because we don\'t want to include another CCTK header file */'); push(@data, '#include "cGH.h"'); - push(@data, '#ifdef __cplusplus'); - push(@data, 'extern "C"'); - push(@data, '#endif'); - push(@data, 'void *CCTKi_VarDataPtr(const cGH *GH, int timelevel,'); - push(@data, ' const char *implementation, const char *varname);'); - push(@data, ''); + push(@data, '#include "cctki_GroupsOnGH.h"'); push(@data, '#define PASS_GROUPSIZE(group, dir) CCTKGROUPNUM_##group >= 0 ? \\'); push(@data, ' CCTK_ArrayGroupSizeI(GH, dir, CCTKGROUPNUM_##group) : &_cctk_zero'); @@ -534,12 +527,12 @@ sub CreateCArgumentDeclarations } my $varname0 = $varname; - push(@declarations, "static int cctki_vi_$varname0 = -1;"); - push(@declarations, "if (cctki_vi_$varname0 < 0) cctki_vi_$varname0 = CCTK_VarIndex($fullvar);"); + push(@declarations, "static int cctki_vi_$varname0 = -100;"); + push(@declarations, "if (cctki_vi_$varname0 == -100) cctki_vi_$varname0 = CCTK_VarIndex($fullvar);"); for(my $level = 0; $level < $ntimelevels; $level++) { - push(@declarations, "CCTK_DECLARE_INIT (CCTK_$type * restrict const, $varname, (CCTK_$type *) CCTK_VarDataPtrI(cctkGH, $level, cctki_vi_$varname0));"); + push(@declarations, "CCTK_DECLARE_INIT (CCTK_$type * restrict const, $varname, (CCTK_$type *) CCTKi_VarDataPtrI(cctkGH, $level, cctki_vi_$varname0));"); # Modify the name for the time level $varname .= '_p'; -- cgit v1.2.3