[PATCH] don't generate empty struct global

Wenji Huang wenji.huang@oracle.com
Tue Feb 24 03:16:00 GMT 2009


Josh Stone wrote:
> Wenji Huang wrote:
>> Impact: clean up
>>
>> struct global will keep the defined global variables. It will be 
>> generated but no reference even no global variables. like,
>>
>> static struct {
>> } global = {
>>
>> };
> 
> Have you seen any actual impact of keeping this?  It doesn't seem to be 
> included in the final module as far as I can see.
> 
Thanks for your review.
I do find the empty struct in generated C file.

$stap -p4 -k -vve 'probe begin{}'
...
static void *contexts = NULL; /* alloc_percpu */


static struct {
} global = {

};

#ifdef STP_TIMING
static __cacheline_aligned Stat time_probe_0;
#endif
...
>> This patch will skip the struct if no global variable.
> 
> That said, your change looks fine to me.  Just tweak it to follow the 
> GNU coding style please.
> 
>   if (...)
>     {
>       ...
>     }
> 
> 
> 
> Josh
> 
oh, I forgot to add some indents.

Regards,
Wenji



More information about the Systemtap mailing list