Re: Some files that CEDET cannot parse and produce errors

Tu Do <[email protected]>
Newsgroups gmane.emacs.cedet
Message-ID <CAOEd9jmpsrMQCRdxhi2GGLT-b8b=CxB1ToGvCq0VWEniA=LZtw@mail.gmail.com>
Hi Eric,

Here is my CEDET setup (pretty much the same with Alex): emacs-rc-cedet.el
<https://bitbucket.org/hoangtu/my-emacs-prelude/src/4d8b90ae0b501daf9581ac347bf45c440b62cdeb/emacs-rc-cedet.el?at=master>
My* init.el* that calls *emacs-rc-cedet.el*: init.el
<https://bitbucket.org/hoangtu/my-emacs-prelude/src/4d8b90ae0b501daf9581ac347bf45c440b62cdeb/init.el?at=master>

To do the testing, I removed everything in my *.emacs.d, *except for
*emacs-rc-cedet.el
*and *init.el*, and *init.el* only loads *emacs-rc-cedet.el.* I also have
latest CEDET, cloned from the github mirror:
https://github.com/alexott/cedet . I opened standalone (not in linux source
tree)* jiffies.h*, run "semantic-lex-test". Strangely, it works fine this
time. I cloned my .emacs.d directory again and tested one more time, this
file with the *jiffies.h* in the kernel source tree, located at
*~/linux/include/linux/**jiffies.h* (as you can see I added "linux/"
directory to *semantic-system-include* in my *emacs-rc-cedet.el*.

I got the error at line 256:

#if !((((NSEC_PER_SEC << 2) / TICK_NSEC) << (SEC_JIFFIE_SC - 2)) &
> 0x80000000)
>

The error is:

Idle Parse Error: "#<buffer jiffies.h> - Arithmetic error"
> Parsing jiffies.h (LL)... [3 times]
> Mark set
> Parsing jiffies.h (LL)...
> Error running timer `semantic-idle-scheduler-function': (arith-error)


To test it further, I deleted that CEDET and downloaded the one from bzr
and setup as above. The result is the same.

I also tested with stock CEDET bundled with my Emacs: GNU Emacs 24.4.50.2
(x86_64-unknown-linux-gnu, GTK+ Version 3.10.8) of 2014-05-05 on
xtuudoo-Satellite-L640

I guess if I can parse once, reparsing won't have any error. When CEDET
successfully parsed the standalone file *jiffies.h* not in linux source
tree, it can successfully parse *jiffies.h *in the linux source tree.

I think it's best if you can reproduce the error directly using my
.emacs.d. Please clone it:

git clone https://bitbucket.org/hoangtu/my-emacs-prelude.git .emacs.d

My repository is battery included, so after your cloned it, you only need
to run your emacs as normal. Note that you must use emacs from trunk, not
even the pre-test version. Otherwise, there will be error when loading
compiled packages. External dependency is GNU Global, and that's it. After
you clone my repo, please try it on the two files again.

One more thing: Is this how you setup CEDET with gcc?

(require 'semantic/bovine/gcc)
(semantic-gcc-setup)

After setting up, does CEDET use GCC for parsing?

Lastly, after applying your patch, the error goes away.

Thanks for your detailed response.

Regards,

Tu.


On Tue, Jun 3, 2014 at 7:58 AM, Eric M. Ludlam <[email protected]>
wrote:

> Hi Tu
>
> Thanks for the misc emails on parsing problems from linux headers.
>
> I tried parsing your attached files, and they seemed to parse ok with no
> errors for me.  For your earlier linux_banner related issue, I don't have
> the exact same header, but the one I do have (linux-headers-3.13.0-27)
> parsed and completed ok.
>
> This means you have something in your default macro table list that I
> don't that is somehow messing it up, or you have some version of hideif
> that is not what I have, or you have an old version of CEDET and we happen
> to have fixed that already.
>
> The easy question then is if you are using the latest version of CEDET
> from the cedet bzr repository?
>
> Next, lets see how you can debug these issues, and perhaps we can focus in
> on the issue.  For example, perhaps my found macros from GCC force CEDET to
> skip parsing the code that you parsed and had bugs in.
>
> I guess the easiest thing would be to create a new buggy.h, and copy in
> the code you found that is throwing the error.  To zoom in on that, load in
> you file, such as jiffies.h, and put the cursor at the beginning, and do:
>
> M-x semantic-lex-test RET
>
> I think if it bails with an error, that should drop you in the right spot.
>
> You can then copy over the bogus code into buggy.h and try it stand alone.
>   If the code you found (some #if statements I assume) you may need to also
> copy in any reference macros to make it work / fail.
>
> This reduced case will then avoid anything that might be forcing my
> version to skip over the buggy code so I can see what the problem might be.
>
> The code I think you are running into is related to the Emacs package
> "hideif" which is a handy tool for evaluating CPP macros for hiding/showing
> sections of code.
>
> In case this is the problem, I have attached a patch that wraps up the
> code that hideif generates to capture errors.  This patch is against the
> latest version of CEDET, so if you are running something else, it should be
> easy to just copy it in to what you have.
>
> I hope this helps.
> Eric
>
>
> On 05/30/2014 01:49 PM, Tu Do wrote:
>
>> Sorry I forgot to attach *jiffies.h
>>
>>
>>
>> *
>>
>>
>> On Sat, May 31, 2014 at 12:48 AM, Tu Do <[email protected]
>> <mailto:[email protected]>> wrote:
>>
>>     One file is in
>>     */usr/include/x86_64-linux-gnu/c++/4.8/ext/opt_random.h* from the
>>
>>     previous email I sent Alex.
>>
>>     One file is in *linux/include/linux/jiffies.h* . I got the following
>>
>>     error parsing this file:
>>
>>      > Parsing jiffies.h (LL)...
>>      > Idle Work Parse Error: "#<buffer jiffies.h> - Arithmetic error"
>>     *
>>     *
>>     When I tried to execute *bovinate*, I got this error:
>>
>>      > hif-shiftleft: Arithmetic error
>>     *
>>     *
>>     *linux* is the linux kernel source tree.
>>
>>
>>     I attached both files here. It seems CEDET having problem parsing
>>     macros with arithmetic operations in it.
>>
>>     Regards,
>>
>>     Tu
>>
>>         While I was making CEDET parse /usr/include, it cannot parse
>>         this particular file:
>>         */usr/include/x86_64-linux-gnu/c++/4.8/ext/opt_random.h
>>
>>
>>         *
>>         I got this error:
>>
>>             Error running timer `semantic-idle-scheduler-function':
>>             (wrong-type-argument number-or-marker-p
>>             "__ORDER_LITTLE_ENDIAN__")
>>
>>
>>         When I tried `bovinate`, I got this error:
>>
>>             eval: Wrong type argument: number-or-marker-p,
>>             "__ORDER_LITTLE_ENDIAN__"
>>
>>
>>         Since Semantic got stuck on this particular file, it cannot
>>         continue. I think CEDET devs should implement a recovery
>> mechanism.
>>
>>         Regards,
>>
>>         Tu.
>>
>>
>>
>>
>> ------------------------------------------------------------
>> ------------------
>> Time is money. Stop wasting it! Get your web API in 5 minutes.
>> www.restlet.com/download
>> http://p.sf.net/sfu/restlet
>>
>>
>>
>> _______________________________________________
>> Cedet-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/cedet-devel
>>
>

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their 
applications. Written by three acclaimed leaders in the field, 
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech

_______________________________________________
Cedet-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cedet-devel
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.