On Wed, Aug 19, 2009 at 10:09 AM, Garrett D'Amore <[email protected]>wrote:

> Reang Su wrote:
>
>> I've a file of function definitions say xxx.h. This file is included and
>> used in other n files. Earlier this definition was static inline yyyy(){}.
>> Now after removing static this complains as "static unused"
>>
>
> So you have a *definition* (as opposed to a declaration) in the header?
>
> And using inline?
>
> You might need to eliminate all the *.ln files to generate a fresh set,
> otherwise you might get this lint error on pass 2 as a result of the static
> function being included into a .ln file that was previously generated from a
> different .c.
>

Looks like eliminating old *.ln files doesn't work. After separating those
definitions to a separate file and keeping only declarations on xxx.h file
I'm able to isolate the problem.
Thank you again.
---Reang.


>
> In general, I find the practice of defining functions in header files (as
> opposed to declaring them) distasteful.  And I never put static declarations
> in a header file.  After all, the point of static is to limit their scope to
> just one file, and (IMO) the main purpose of a header file is to provide
> declarations that can be shared amongst multiple source files.
>
> Putting such static declarations in the header file only serves (IMO) to
> add confusion as to what functions are available where.
>
> (I'll also note that at this point I usually try to keep simple drivers to
> a single source file.  It allows the compiler some additional flexibility
> when performing optimizations, and makes it easier to find functions and
> declarations if you only have to look in a single file.)
>
>   -- Garrett
>
>>  ---Reang.
>>
>> On Wed, Aug 19, 2009 at 9:48 AM, Garrett D'Amore <[email protected]<mailto:
>> [email protected]>> wrote:
>>
>>    Reang Su wrote:
>>
>>        Hi Garrett,
>>         I tried without using /*LINTED */ initially, it didn't work.
>>        After removing static from my function definition I was still
>>        getting "warning: static unused", So I tried with /*LINTED */.
>>        Unfortunately this also didn't work.
>>
>>
>>    Lint pass two over a whole program might notice that the function
>>    is not used.  But if its a device driver, it should get by if you
>>    remove the static, without a LINTED flag.  The behavior you're
>>    describing is not one I've ever seen.
>>
>>    But again, if the function is static, and *not* used, then why
>>    have it in the first place?
>>
>>      - Garrett
>>
>>         Thank you,
>>        --Reang.
>>
>>
>>        On Tue, Aug 18, 2009 at 7:23 PM, Garrett D'Amore
>>        <[email protected] <mailto:[email protected]>
>>         <mailto:[email protected] <mailto:[email protected]>>> wrote:
>>
>>           Reang Su wrote:
>>
>>               Hi ,
>>                I'm stuck while removing E_STATIC_UNUSED LINTTAG from my
>>               driver Makefile.
>>                Once I removed this LINTTAG in my Makefile I get following
>>               warning.
>>               xxx.h", line 85: warning: static unused:
>>               __hal_ifmsg_is_manager_up (E_STATIC_UNUSED)
>>                I removed static from my function definition and added
>>               /*LINTED */ before it. Now I get
>>                E_SUPPRESSION_DIRECTIVE_UNUSED on that line.
>>                xxx.h", line 85: warning: lint suppression directive
>>        not used
>>               (E_SUPPRESSION_DIRECTIVE_UNUSED)
>>
>>
>>           You shouldn't have also added /*LINTED*/.  Since you
>>        removed the
>>           "static", you shouldn't have got the
>>        E_STATIC_UNUSED_LINTTAG anymore.
>>
>>           Of course, if the function really was static, and not used
>>           anywhere, maybe you should have just removed it, and saved a
>>           little space in the code and in the binary.
>>
>>             - Garrett
>>
>>                Please suggest.
>>                Thank you,
>>                -Reang,
>>
>> ------------------------------------------------------------------------
>>
>>               _______________________________________________
>>               driver-discuss mailing list
>>               [email protected]
>>        <mailto:[email protected]>
>>               <mailto:[email protected]
>>        <mailto:[email protected]>>
>>
>>               http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>>
>>
>>
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> driver-discuss mailing list
>> [email protected]
>> http://mail.opensolaris.org/mailman/listinfo/driver-discuss
>>
>>
>
>
_______________________________________________
driver-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/driver-discuss

Reply via email to