summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorgoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2004-11-30 22:19:53 +0000
committergoodale <goodale@17b73243-c579-4c4c-a9d2-2d5706c11dac>2004-11-30 22:19:53 +0000
commita3cf84ffacb27e2f94f2d8e9cdd0758c933405db (patch)
tree570534317056df0eb895362df35aa6eaecbf75b1 /lib
parent0a2a0d76f3ecb9ea4044d8c627e1670eb6b52204 (diff)
Add the restrict qualifier to C/C++ arguments.
git-svn-id: http://svn.cactuscode.org/flesh/trunk@3920 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib')
-rw-r--r--lib/sbin/GridFuncStuff.pl26
1 files changed, 25 insertions, 1 deletions
diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl
index d1eedf65..a6e2496d 100644
--- a/lib/sbin/GridFuncStuff.pl
+++ b/lib/sbin/GridFuncStuff.pl
@@ -59,6 +59,30 @@ sub CreateVariableBindings
push(@data, '#include "cctk_Types.h"');
push(@data, '');
push(@data, '#ifdef CCODE');
+
+ # Deprecated in 4.0 beta 17
+ push(@data, '/* Older configurations do not define CCTK_RESTRICT.');
+ push(@data, ' * Remove this section after 4.0 beta 16 has been released');
+ push(@data, ' */');
+
+ push(@data, '#ifndef CCTK_RESTRICT');
+ push(@data, '#ifdef __cplusplus');
+ push(@data, '#ifdef CCTK_CXX_RESTRICT');
+ push(@data, '#define CCTK_RESTRICT CCTK_CXX_RESTRICT');
+ push(@data, '#else');
+ push(@data, '#define CCTK_RESTRICT');
+ push(@data, '#endif');
+ push(@data, '#else');
+ push(@data, '#ifdef CCTK_C_RESTRICT');
+ push(@data, '#define CCTK_RESTRICT CCTK_C_RESTRICT');
+ push(@data, '#else');
+ push(@data, '#define CCTK_RESTRICT');
+ push(@data, '#endif');
+ push(@data, '#endif');
+ push(@data, '#endif');
+
+ # End deprecated section
+
push(@data, '/* prototype for CCTKi_VarDataPtr() goes here');
push(@data, ' because we don\'t want to include another CCTK header file */');
push(@data, '#ifdef __cplusplus');
@@ -526,7 +550,7 @@ sub CreateCArgumentDeclarations
for($level = 0; $level < $ntimelevels; $level++)
{
- push(@declarations, "CCTK_$type *$varname = ($varname = (CCTK_$type *) \&$varname, (CCTK_$type *) CCTKi_VarDataPtr(cctkGH, $level, $implementation, $var));");
+ push(@declarations, "CCTK_$type * CCTK_RESTRICT $varname = ($varname = (CCTK_$type *) \&$varname, (CCTK_$type *) CCTKi_VarDataPtr(cctkGH, $level, $implementation, $var));");
# Modify the name for the time level
$varname .= '_p';