Re: [PATCH dwarves 2/3] dwarves_fprintf: support skipping modifier

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2023-03-10 at 14:50 +0000, Alan Maguire wrote:
[...]
> diff --git a/dwarves_fprintf.c b/dwarves_fprintf.c
> index 5c6bf9c..b20a473 100644
> --- a/dwarves_fprintf.c
> +++ b/dwarves_fprintf.c
> @@ -506,7 +506,8 @@ static const char *tag__ptr_name(const struct tag *tag, const struct cu *cu,
>  				struct tag *next_type = cu__type(cu, type->type);
>  
>  				if (next_type && tag__is_pointer(next_type)) {
> -					const_pointer = "const ";
> +					if (!conf->skip_emitting_modifier)
> +						const_pointer = "const ";
>  					type = next_type;
>  				}
>  			}
> @@ -580,13 +581,16 @@ static const char *__tag__name(const struct tag *tag, const struct cu *cu,
>  				   *type_str = __tag__name(type, cu, tmpbf,
>  							   sizeof(tmpbf),
>  							   pconf);
> -			switch (tag->tag) {
> -			case DW_TAG_volatile_type: prefix = "volatile "; break;
> -			case DW_TAG_const_type:    prefix = "const ";	 break;
> -			case DW_TAG_restrict_type: suffix = " restrict"; break;
> -			case DW_TAG_atomic_type:   prefix = "_Atomic ";  break;
> +			if (!conf->skip_emitting_modifier) {
> +				switch (tag->tag) {
> +				case DW_TAG_volatile_type: prefix = "volatile "; break;
> +				case DW_TAG_const_type: prefix = "const"; break;

Here the space is removed from literal "const " and this results in
the following output (`pahole -F btf --sort ./vmlinux`):

    struct ZSTD_inBuffer_s {
            constvoid  *               src;                  /*     0     8 */
            ...
    };

(Sorry for late replies).

[...]





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux