* symbol.h question
@ 2018-01-22 5:41 Randy Dunlap
2018-01-22 5:56 ` Luc Van Oostenryck
2018-01-22 9:15 ` Dan Carpenter
0 siblings, 2 replies; 3+ messages in thread
From: Randy Dunlap @ 2018-01-22 5:41 UTC (permalink / raw)
To: Linux-Sparse
Hi,
What is the purpose/meaning of these inline + extern in symbol.h?
static inline int is_ptr_type(struct symbol *type)
{
if (type->type == SYM_NODE)
type = type->ctype.base_type;
return type->type == SYM_PTR || type->type == SYM_ARRAY || type->type == SYM_FN;
}
///later:
extern int is_ptr_type(struct symbol *);
thanks,
--
~Randy
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: symbol.h question
2018-01-22 5:41 symbol.h question Randy Dunlap
@ 2018-01-22 5:56 ` Luc Van Oostenryck
2018-01-22 9:15 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Luc Van Oostenryck @ 2018-01-22 5:56 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Linux-Sparse
On Sun, Jan 21, 2018 at 09:41:25PM -0800, Randy Dunlap wrote:
> Hi,
>
> What is the purpose/meaning of these inline + extern in symbol.h?
>
> static inline int is_ptr_type(struct symbol *type)
> {
> if (type->type == SYM_NODE)
> type = type->ctype.base_type;
> return type->type == SYM_PTR || type->type == SYM_ARRAY || type->type == SYM_FN;
> }
It's now a misnomer. It's purpose now is to check if the type
is a pointer or can degenerate to a pointer.
A better name should be used.
> ///later:
>
> extern int is_ptr_type(struct symbol *);
This must be removed (cfr. https://github.com/lucvoo/sparse/commit/46047a0706e5 )
Regards,
-- Luc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: symbol.h question
2018-01-22 5:41 symbol.h question Randy Dunlap
2018-01-22 5:56 ` Luc Van Oostenryck
@ 2018-01-22 9:15 ` Dan Carpenter
1 sibling, 0 replies; 3+ messages in thread
From: Dan Carpenter @ 2018-01-22 9:15 UTC (permalink / raw)
To: Randy Dunlap; +Cc: Linux-Sparse
On Sun, Jan 21, 2018 at 09:41:25PM -0800, Randy Dunlap wrote:
> Hi,
>
> What is the purpose/meaning of these inline + extern in symbol.h?
>
> static inline int is_ptr_type(struct symbol *type)
> {
> if (type->type == SYM_NODE)
> type = type->ctype.base_type;
> return type->type == SYM_PTR || type->type == SYM_ARRAY || type->type == SYM_FN;
> }
>
> ///later:
>
> extern int is_ptr_type(struct symbol *);
>
It takes a symbol pointer and tells you if the symbol represents a
pointer (or array or a function since those are basically pointers too).
regards,
dan carpenter
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2018-01-22 9:15 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-22 5:41 symbol.h question Randy Dunlap
2018-01-22 5:56 ` Luc Van Oostenryck
2018-01-22 9:15 ` Dan Carpenter
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).