|
|
linting C source code with embedded asm?
I'm using the latest version of lint, and it chokes on code that uses
the "asm" keyword to allow you to create function calls which directly
use assembly code.
It seems when lint seems the asm, it's like a syntax error and
anything lint says after that is pretty much bogus. It'll say
undefined symbols for symbols are defined, etc.. So it gets tripped up
by the asm.
Anyone know how to work around this and get lint to work with asm
calls?
|
|
0
|
|
|
|
Reply
|
lucid1
|
10/14/2003 4:15:41 PM |
|
On Tue, 14 Oct 2003, Brian wrote:
> I'm using the latest version of lint, and it chokes on code that uses
> the "asm" keyword to allow you to create function calls which directly
> use assembly code.
>
> It seems when lint seems the asm, it's like a syntax error and
> anything lint says after that is pretty much bogus. It'll say
> undefined symbols for symbols are defined, etc.. So it gets tripped up
> by the asm.
>
> Anyone know how to work around this and get lint to work with asm
> calls?
OFf the top of my head, I don't know. But I would humbly submit
that mixing assembler and C in one source file is not a good
practice most of the time. Unless there are very good reasons
not to, I'd suggest putting all of your assembler in a separate
..s file.
--
Rich Teer, SCNA, SCSA
President,
Rite Online Inc.
Voice: +1 (250) 979-1638
URL: http://www.rite-online.net
|
|
0
|
|
|
|
Reply
|
Rich
|
10/14/2003 9:45:29 PM
|
|
Hi
Brian wrote:
> I'm using the latest version of lint, and it chokes on code that uses
> the "asm" keyword to allow you to create function calls which directly
> use assembly code.
Which latest version of lint? Solaris doesn't ship a lint as far as
I know - it comes with the compilers.
On a Solaris 9 sparc system I ran lint on
the following trivial (and meaningless) C file:
int
main()
{
asm("mov %g3, %o0");
}
$ lint a.c
(5) warning: Function has no return statement : main
function falls off bottom without returning value
(5) main
$ cc -V
cc: Forte Developer 7 C 5.4 2002/03/09
usage: cc [ options] files. Use 'cc -flags' for details
That's a reasonably recent version. Trying it on the
oldest version I could find (2.0.1 from 03 Sep 1992)
works just as above.
> It seems when lint seems the asm, it's like a syntax error and
> anything lint says after that is pretty much bogus. It'll say
> undefined symbols for symbols are defined, etc.. So it gets tripped up
> by the asm.
>
> Anyone know how to work around this and get lint to work with asm
> calls?
See lint(1) manpage for suggestions. You might find that /*LINTED*/
on the line preceding the asm helps. But it sounds like the lint
version you have has bigger problems.
Gavin
|
|
0
|
|
|
|
Reply
|
Gavin
|
10/14/2003 10:16:06 PM
|
|
In article <961d6f35.0310140815.72be7930@posting.google.com>,
lucid1@mediaone.net (Brian) writes:
> I'm using the latest version of lint, and it chokes on code that uses
> the "asm" keyword to allow you to create function calls which directly
> use assembly code.
>
> It seems when lint seems the asm, it's like a syntax error and
> anything lint says after that is pretty much bogus. It'll say
> undefined symbols for symbols are defined, etc.. So it gets tripped up
> by the asm.
>
> Anyone know how to work around this and get lint to work with asm
> calls?
Maybe #ifdef it on lint (or possibly __lint) with a dummy function in C
there and in the #else the assembler version.
--
mailto:rlhamil@smart.net http://www.smart.net/~rlhamil
|
|
0
|
|
|
|
Reply
|
Richard
|
10/15/2003 11:52:29 AM
|
|
Thanks for the replies. Sorry about the incorrect information on where
lint is coming from. With unix it's hard for me to tell what comes
with the operating system and what doesn't. It's part of the SUNWspro
package from sun. Sun ships it with it's compiler, and there are docs
for lint on their home page.
I believe I'm using the latest version, 6.0_U2.
The assembly code that appears in our source is formatted like this:
unsigned int blah( void );
asm unsigned int blah()
{
//assembler instruction
}
I was hoping lint would just have an option to ignore certain
keywords, so maybe if it saw "asm" it could just carry on. Instead,
it trips up and produces incorrect lint warnings.
|
|
0
|
|
|
|
Reply
|
lucid1
|
10/15/2003 7:57:10 PM
|
|
|
4 Replies
264 Views
(page loaded in 0.105 seconds)
|
|
|
|
|
|
|
|
|