* Differences in the behaviour of sparse and gcc within cygwin environment
@ 2007-05-18 11:43 Thomas Schmid
2007-05-18 20:47 ` Al Viro
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schmid @ 2007-05-18 11:43 UTC (permalink / raw)
To: linux-sparse
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
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
I know that number 2 and 3 are problems which only occur within an cygwin
environment and number 3 isn't the best way to include files,
but is there any chance to get this fixed?
Best regards,
Thomas Schmid
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Differences in the behaviour of sparse and gcc within cygwin environment
2007-05-18 11:43 Differences in the behaviour of sparse and gcc within cygwin environment Thomas Schmid
@ 2007-05-18 20:47 ` Al Viro
2007-05-21 13:20 ` Antwort: " Thomas Schmid
0 siblings, 1 reply; 4+ messages in thread
From: Al Viro @ 2007-05-18 20:47 UTC (permalink / raw)
To: Thomas Schmid; +Cc: linux-sparse
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.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Antwort: Re: Differences in the behaviour of sparse and gcc within cygwin environment
2007-05-18 20:47 ` Al Viro
@ 2007-05-21 13:20 ` Thomas Schmid
2007-05-21 23:16 ` Josh Triplett
0 siblings, 1 reply; 4+ messages in thread
From: Thomas Schmid @ 2007-05-21 13:20 UTC (permalink / raw)
To: Al Viro; +Cc: linux-sparse
linux-sparse-owner@vger.kernel.org schrieb am 18.05.2007 22:47:35:
> On Fri, May 18, 2007 at 01:43:11PM +0200, Thomas Schmid wrote:
> > 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*
;-) Really that bad?
>
> 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.
The code which I like to use sparse with, is some sort of living 3rd party
thing.
I fear, these are not the only "misguided extensions" used, which work
with cygwin GCC 2.95.3.
I also tried to pre-process that code with cpp - but then I lose the
position-data of the declarations i try to get info from.
It's not possible to use cpp integrated in sparse, isn't it?
Best regards
Thomas Schmid
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Antwort: Re: Differences in the behaviour of sparse and gcc within cygwin environment
2007-05-21 13:20 ` Antwort: " Thomas Schmid
@ 2007-05-21 23:16 ` Josh Triplett
0 siblings, 0 replies; 4+ messages in thread
From: Josh Triplett @ 2007-05-21 23:16 UTC (permalink / raw)
To: Thomas Schmid; +Cc: Al Viro, linux-sparse
[-- Attachment #1: Type: text/plain, Size: 460 bytes --]
Thomas Schmid wrote:
> I also tried to pre-process that code with cpp - but then I lose the
> position-data of the declarations i try to get info from.
> It's not possible to use cpp integrated in sparse, isn't it?
In theory, we could add support for the line-number information provided by
the GCC preprocessor. That seems useful, though it can't provide as much
information as Sparse's usual line-and-character information.
- Josh Triplett
[-- Attachment #2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 252 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2007-05-21 23:16 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-18 11:43 Differences in the behaviour of sparse and gcc within cygwin environment Thomas Schmid
2007-05-18 20:47 ` Al Viro
2007-05-21 13:20 ` Antwort: " Thomas Schmid
2007-05-21 23:16 ` Josh Triplett
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).