[splint-discuss] Re: Parse error due to byteorder.h
rasmit.ranjan at wipro.com
rasmit.ranjan at wipro.com
Mon May 29 00:32:46 EDT 2006
> I wrote:
> > HOW ABOUT SHOWING US THE LINE(S) OF CODE INVOLVED?
>
> <rasmit.ranjan at wipro.com> still has not done this.
>
> No 'splint -help parseerrors' does not help as wel.
>
> What do you *mean* "does not help"?
>
> For example, "splint -help parseerrors" says, amongst other things,
>
> Splint supports some of the GNU (gcc) compiler extensions, if the
> +gnuextensions flag is set. You may be able to workaround other
> compiler extensions by using a pre-processor define. Alternately,
> you can surround the unparseable code with
>
> # ifndef S_SPLINT_S
> ...
> # endif
>
> Have you tried setting the +gnuextensions flag?
> What happened when you did?
On including +gnuextensions flag it gives
setting +gnuextensions redundant with current value
And same parse error comes.
Also I tried using #ifndef S_SPLINT_S....but did not work. Still it
gives the same error.
>
> What particular extension is giving splint trouble?
> IT WOULD HELP A LOT IF YOU SHOWED US THE LINES THAT SPLINT IS
> COMPLAINING ABOUT; we don't have the same .h file as you.
> Is it something you could try giving a #define for so that
> what splint sees is different from what gcc sees?
>
> Is it possible for you to make a copy of the .h file, put
> #ifndef S_SPLINT_S around the offending code like -help
> parseerrors suggests, and include that .h file instead of the
> original?
No this is not possible. In my case, I have a module having more than 20
.c files and some of the .h files. In one of the .h file I have
included byteorder.h. But even if I remove this file still splint gives
same sparse error in byteorder.h.
That means byteorder.h is getting linked indirectly from any other .h
file I have included. Anyway I am sending you the file byteorder.h.
Splint gives sparse error in line no 37, col no 7. and the error is
../../../../include/asm/byteorder.h:37:7:
Parse Error. (For help on parse errors, see splint -help
parseerrors.)
*** Cannot continue.
make: *** [do_splint] Error 1
#ifndef _I386_BYTEORDER_H
#define _I386_BYTEORDER_H
#include <asm/types.h>
#include <linux/compiler.h>
#ifdef __GNUC__
/* For avoiding bswap on i386 */
#ifdef __KERNEL__
#include <linux/config.h>
#endif
static __inline__ __attribute_const__ __u32 ___arch__swab32(__u32 x)
{
#ifdef CONFIG_X86_BSWAP
__asm__("bswap %0" : "=r" (x) : "0" (x));
#else
__asm__("xchgb %b0,%h0\n\t" /* swap lower bytes */
"rorl $16,%0\n\t" /* swap words */
"xchgb %b0,%h0" /* swap higher bytes */
:"=q" (x)
: "0" (x));
#endif
return x;
}
static __inline__ __attribute_const__ __u64 ___arch__swab64(__u64 val)
{
union {
struct { __u32 a,b; } s;
__u64 u;
} v;
v.u = val;
#ifdef CONFIG_X86_BSWAP
asm("bswapl %0 ; bswapl %1 ; xchgl %0,%1"
: "=r" (v.s.a), "=r" (v.s.b)
// This line gives the parse error
: "0" (v.s.a), "1" (v.s.b));
#else
v.s.a = ___arch__swab32(v.s.a);
v.s.b = ___arch__swab32(v.s.b);
asm("xchgl %0,%1" : "=r" (v.s.a), "=r" (v.s.b) : "0" (v.s.a),
"1" (v.s.b));
#endif
return v.u;
}
/* Do not define swab16. Gcc is smart enough to recognize "C" version
and
convert it into rotation or exhange. */
#define __arch__swab64(x) ___arch__swab64(x)
#define __arch__swab32(x) ___arch__swab32(x)
#define __BYTEORDER_HAS_U64__
#endif /* __GNUC__ */
#include <linux/byteorder/little_endian.h>
#endif /* _I386_BYTEORDER_H */
>
> Then what next ? Is there any other way out?
>
> I ask again, try SHOWING us the actual lines of code.
> At least some of us do not have the same version of the file
> as you do.
>
>
>
> ------------------------------
>
> _______________________________________________
> splint-discuss mailing list
> splint-discuss at ares.cs.Virginia.EDU
> http://www.cs.Virginia.EDU/mailman-2.1.5/listinfo/splint-discuss
>
>
>
>
The information contained in this electronic message and any attachments to this message are intended for the exclusive use of the addressee(s) and may contain proprietary, confidential or privileged information. If you are not the intended recipient, you should not disseminate, distribute or copy this e-mail. Please notify the sender immediately and destroy all copies of this message and any attachments.
WARNING: Computer viruses can be transmitted via email. The recipient should check this email and any attachments for the presence of viruses. The company accepts no liability for any damage caused by any virus transmitted by this email.
www.wipro.com
More information about the splint-discuss
mailing list