diff options
author | knarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2010-11-23 19:28:02 +0000 |
---|---|---|
committer | knarf <knarf@17b73243-c579-4c4c-a9d2-2d5706c11dac> | 2010-11-23 19:28:02 +0000 |
commit | 7f0d29bc6b722a44191aaa06daa01c983e82c66e (patch) | |
tree | 657a866e2566558f79cfef298ba71b1da4b9f60a /lib/sbin | |
parent | b15b5f628e90931cee5d0d4aed64791946b4a727 (diff) |
support __unused__ where known. This let's e.g. gcc know that especially the Cactus variables might be unused and should not be reported as such. This closes ET ticket #1
git-svn-id: http://svn.cactuscode.org/flesh/trunk@4651 17b73243-c579-4c4c-a9d2-2d5706c11dac
Diffstat (limited to 'lib/sbin')
-rw-r--r-- | lib/sbin/CreateParameterBindings.pl | 10 | ||||
-rw-r--r-- | lib/sbin/GridFuncStuff.pl | 4 | ||||
-rw-r--r-- | lib/sbin/create_c_stuff.pl | 12 | ||||
-rw-r--r-- | lib/sbin/create_fortran_stuff.pl | 2 |
4 files changed, 6 insertions, 22 deletions
diff --git a/lib/sbin/CreateParameterBindings.pl b/lib/sbin/CreateParameterBindings.pl index 7905238b..9202d98e 100644 --- a/lib/sbin/CreateParameterBindings.pl +++ b/lib/sbin/CreateParameterBindings.pl @@ -200,7 +200,6 @@ sub CreateParameterBindings push(@data, " DECLARE_PRIVATE_\U$thorn\E_STRUCT_PARAMS \\") if($header_files{"\U$thorn\E PRIVATE"}); - @use = (); my $delim = ' '; foreach $friend (split(' ',$rhparameter_db->{"\U$thorn\E SHARES implementations"})) { @@ -222,18 +221,11 @@ sub CreateParameterBindings $varprefix = ' const *'; } - push(@data, " $type_string$varprefix const $parameter = RESTRICTED_\U$friend\E_STRUCT.$realname; \\"); - push(@use, " $delim dummy_$friend\_$realname = sizeof( $parameter ) \\"); + push(@data, " CCTK_DECLARE_INIT ($type_string$varprefix const, $parameter, RESTRICTED_\U$friend\E_STRUCT.$realname); \\"); $delim = ','; } } - if(@use) - { - push(@data, " enum { \\"); - push(@data, @use); - push(@data, " };"); - } push(@data, ''); push(@data, "#endif /* _\U$thorn\E_PARAMETERS_H_ */"); push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline diff --git a/lib/sbin/GridFuncStuff.pl b/lib/sbin/GridFuncStuff.pl index 10699255..b5972f8c 100644 --- a/lib/sbin/GridFuncStuff.pl +++ b/lib/sbin/GridFuncStuff.pl @@ -481,7 +481,7 @@ sub CreateFortranArgumentDeclarations for(my $level = 0; $level < $ntimelevels; $level++) { - push(@declarations, "CCTK_$type $argument$dimensions"); + push(@declarations, "CCTK_DECLARE(CCTK_$type,$argument,$dimensions)"); # Modify the name for the time level $argument .= '_p'; @@ -527,7 +527,7 @@ sub CreateCArgumentDeclarations for(my $level = 0; $level < $ntimelevels; $level++) { - push(@declarations, "CCTK_$type * CCTK_RESTRICT $varname = (cctki_dummy_int = \&$varname - \&$varname, (CCTK_$type *) CCTKi_VarDataPtr(cctkGH, $level, $implementation, $var));"); + push(@declarations, "CCTK_DECLARE_INIT (CCTK_$type * CCTK_RESTRICT const, $varname, (CCTK_$type *) CCTKi_VarDataPtr(cctkGH, $level, $implementation, $var));"); # Modify the name for the time level $varname .= '_p'; diff --git a/lib/sbin/create_c_stuff.pl b/lib/sbin/create_c_stuff.pl index 124fd560..3277c15f 100644 --- a/lib/sbin/create_c_stuff.pl +++ b/lib/sbin/create_c_stuff.pl @@ -172,11 +172,10 @@ sub GetThornParameterList sub CreateCStructureParameterHeader { my($prefix, $structure, $rhparameters, $rhparameter_db) = @_; - my($line,@data,@use); + my($line,@data); my(%parameters); my($type, $type_string); my(@definition); - my(@use); # Create the structure push(@data, '#ifdef __cplusplus'); @@ -207,8 +206,7 @@ sub CreateCStructureParameterHeader my $realname = $rhparameter_db->{"\U$rhparameters->{$parameter} $parameter\E realname"}; push(@data, " $type_string $realname$suffix;"); - push(@definition, " $type_string$varprefix const $parameter = $structure.$realname; \\"); - push(@use, " $delim dummy\_$structure\_$parameter = sizeof( $parameter ) \\"); + push(@definition, " CCTK_DECLARE_INIT ($type_string$varprefix const, $parameter, $structure.$realname); \\"); $delim = ','; } @@ -228,12 +226,6 @@ sub CreateCStructureParameterHeader push(@data, "#define DECLARE_${structure}_PARAMS \\"); push(@data, @definition); - if( @use ) - { - push(@data, " enum { \\"); - push(@data, @use); - push(@data, " }; \\"); - } push(@data, "\n"); # workaround for perl 5.004_04 to add a trailing newline diff --git a/lib/sbin/create_fortran_stuff.pl b/lib/sbin/create_fortran_stuff.pl index 9b15521b..2fa3ab99 100644 --- a/lib/sbin/create_fortran_stuff.pl +++ b/lib/sbin/create_fortran_stuff.pl @@ -178,7 +178,7 @@ sub CreateFortranCommonDeclaration $name = $rhparameter_db->{"\U$rhparameters->{$parameter} $parameter\E realname"}; } - $line = "$type_string $name$suffix"; + $line = "CCTK_DECLARE($type_string,$name,$suffix)"; $definition .= "$sepchar$name"; push(@data, $line); |