summaryrefslogtreecommitdiff
path: root/lib/sbin/CreateParameterBindings.pl
diff options
context:
space:
mode:
authorswhite <swhite@17b73243-c579-4c4c-a9d2-2d5706c11dac>2006-10-26 12:17:42 +0000
committerswhite <swhite@17b73243-c579-4c4c-a9d2-2d5706c11dac>2006-10-26 12:17:42 +0000
commit81e9c2449fbcae17658163af750382744cfee06c (patch)
tree9db1b0a2effbea12ec1042d6bd29c63b9bf40ca9 /lib/sbin/CreateParameterBindings.pl
parent0d8e0648fd8ea848f2bf1a6199251cda266af84b (diff)
This is the application of the patch reported in Patches and Developsrs
Fri 20 Oct 06 "g++ warning: operation on *bla* may be undefined" and PR 2070 http://www.cactuscode.org/cactus_cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&data base=cactus&pr=2070 Preprocessing arrangements/Carpet/Carpet/src/Timing.cc Compiling arrangements/Carpet/Carpet/src/Timing.cc configs/chain_gcc_carpet/build/Carpet/Timing.cc: In function ‘void Carpet::InitTimingVariables(const cGH*)’: configs/chain_gcc_carpet/build/Carpet/Timing.cc:120: warning: operation on ‘cctki_use’ may be undefined The culprit was in generated bindings code meant to get rid of warnings about unused variables corresponding to Cactus parameters included in code by the DECLARE_CCTK_PARAMETERS macro. This replaces the offending code with enums initialised by sizeof calls; the nature of all the entities involved is much clearer, both to compilers and to me. Like the existing solution, this permits the user to proceed to make more declarations after the DECLARE_CCTK_PARAMETERS macro (simply putting a list of variable assignments after the declaration would not have that property). git-svn-id: http://svn.cactuscode.org/flesh/trunk@4381 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin/CreateParameterBindings.pl')
-rw-r--r--lib/sbin/CreateParameterBindings.pl9
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl
index b13b75fc..7905238b 100644
--- a/lib/sbin/CreateParameterBindings.pl
+++ b/lib/sbin/CreateParameterBindings.pl
@@ -201,6 +201,7 @@ sub CreateParameterBindings
if($header_files{"\U$thorn\E PRIVATE"});
@use = ();
+ my $delim = ' ';
foreach $friend (split(' ',$rhparameter_db->{"\U$thorn\E SHARES implementations"}))
{
$rhinterface_db->{"IMPLEMENTATION \U$friend\E THORNS"} =~ m:([^ ]*):;
@@ -222,16 +223,16 @@ sub CreateParameterBindings
}
push(@data, " $type_string$varprefix const $parameter = RESTRICTED_\U$friend\E_STRUCT.$realname; \\");
- push(@use, " RESTRICTED_FRIENDS_STRUCT_use = \&$parameter, \\");
+ push(@use, " $delim dummy_$friend\_$realname = sizeof( $parameter ) \\");
+ $delim = ',';
}
}
if(@use)
{
- push(@data, ' const void *RESTRICTED_FRIENDS_STRUCT_use = ( \\');
+ push(@data, " enum { \\");
push(@data, @use);
- push(@data, ' RESTRICTED_FRIENDS_STRUCT_use = &RESTRICTED_FRIENDS_STRUCT_use \\');
- push(@data, ' );');
+ push(@data, " };");
}
push(@data, '');
push(@data, "#endif /* _\U$thorn\E_PARAMETERS_H_ */");