On Fri, May 18, 2007 at 01:43:11PM +0200, Thomas Schmid wrote:
> I use sparse in a cygwin environment to obtain pre-build info from 
> sourcefiles which get comiled with gcc (also compiled with cygwin).
> 
> After some time of using sparse, I noticed some differences in the 
> behaviour of sparse and gcc:
> 1. Symbolnames with "$" are accepted by gcc but not by sparse

ewww...  It's not hard to change, but I strongly recommend making it
ifdefed and *not* included on sane boxen.  Rationale: that affects one
of the hottest paths in the entire thing.

Who uses $ in identifiers, anyway, when it's guaranteed to be non-portable?
gcc accepts it as a bloody misguided extension, but it's not standard C by
any stretch of imagination.  What are you working with, a bunch of old code
originating on VMS?

> 2. #include "..\plc.h" is accepted by gcc but not by sparse => "\" is 
> interpreted as escape- character
> 3. #include "D:\plc.h" is accepted by gcc but not by sparse

*argh*

sparse takes a shortcut - it treats header-name as string-literal.  In
principle, these are distinct tokens.  We could try to change that, but...
that makes tokenizer context-dependent in a fairly upleasant way.

Note that \ in header-name is explicitly undefined behaviour (6.4.7(3)),
and compilers I've seen on weird systems of that kind tend to remap / on \
in header names anyway before trying to look for files to include.
-
To unsubscribe from this list: send the line "unsubscribe linux-sparse" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to