Currently CCTK_DECLARE_ARGUMENTS contains code like this:
static int varindex = -100; if (varindex == -100) varindex = CCTK_VarIndex("thorn::var"); var = CCTKi_VarDataPtr(cctGH, 0, varindex);
ie it calls the two functions VarIndex and VarDataPtr for all variables that the thorn defines or inherits. This happens no matter whether the variable "var" is later used in the routine or not since the two functions could have side effects. The patch in the pull requests declares the functions "pure", ie side effect free (https://gcc.gnu.org/onlinedocs/gcc/Common-Function-Attributes.html#index-functions-that-have-no-side-effects-3320) which lets the compiler remove the call to the functions if their result is not used.
Technically CCTK_VarIndex does have a side effect: it can call CCTK_VWarn (at level 6) for unknown variable names though the result does not affect the computation. CCTKi_VarDataPtr is explicitly designed to be side-effect free.
The patch would lead to slightly smaller code and possible slightly faster code as well when CCTK_DECLARE_ARGUMENTS is used often or with many inherited variables.
The pull request is at https://bitbucket.org/cactuscode/cactus/pull-requests/34/cactus-mark-routines-used-by/diff