thetna
thetna

Reputation: 7143

Function defined but not used in C

I have following code:

static __inline__ LIST list_List(POINTER P)
{
  return list_Cons(P,list_Nil());
 }

After compilation I got following warning:

inlining is unlikely but function size may grow

I removed the inline and changed into the following :

static  LIST list_List(POINTER P)
{
  return list_Cons(P,list_Nil());
 }

Now I get the following warning:

list_List is defined but not used.

I didn't used to get above warning "function is defined but not used" before removing the inline. I got the warning only after I remove the inline. Actually the function is used .When i comment the above function, i am getting following error:

 In function 
  (.text+0x148b): undefined reference to `list_List'
  In function `list_CopyWithElement':

Can anybody please suggest me how can remove that warning.

Upvotes: 0

Views: 4566

Answers (1)

David Gelhar
David Gelhar

Reputation: 27900

"static" means that the function can only be used within the scope of the current compilation unit (source file, basically, unless you're doing weird things with #include).

Thus, the compiler is warning you that you have declared a function that cannot be used outside the current source file, but which is not (currently) used within that source file either.

Upvotes: 2

Related Questions