Re: semanticdb typecache error

Vyacheslav Gonakhchyan <[email protected]> Sun, 25 Sep 2016 10:57:19 +0300
Newsgroups gmane.emacs.semantic
Message-ID <[email protected]>
Hi. Updated emacs to 25.1. Cleared semanticdb dir. Still getting 
typecache errors.

To reproduce save this file in any dir. Run 
semantic-debug-idle-work-function at least two times. And you will get 
something like (wrong-type-argument stringp (((0) (0) "Bool"))).

#include <check.h>
#include <stdlib.h>
#include "platform.h"
#include "bb.c"
#include "bvh.c"
#include "error.c"
#include "list.c"
#include "geom.c"
#include "octree.c"
#include "frustum.c"
#include "my_math.c"
#include "check_suite.c"

START_TEST(bvhCreateOctree) {
     //create instances array
     const s32 numInstances = 2;
     const r32 half = 1/2.0f;
     AssetInstance i[numInstances];
     BoundingBox bb0 = { {half,   half,   0}, {half, half, 0} };
     BoundingBox bb1 = { {1+half, 1+half, 0}, {half, half, 0} };
     i[0].bb = bb0;
     i[1].bb = bb1;

     //create octree and add instances
     BoundingBox sceneBB = { {1,1,0}, {1,1,0} };
     r32 minLeafSize = octr_get_min_leaf_size(&sceneBB, i, numInstances, 1);
     printf("minLeafSize = %.2f\n", minLeafSize);
     OctreeNode *octrRoot = octr_create_node(&sceneBB, minLeafSize);
     octr_add_item(octrRoot, i, minLeafSize, 0);
     octr_add_item(octrRoot, i+1, minLeafSize, 0);

     //sort by left edge
     bvh_sort_instances(numInstances, i, Axis_X);

     //create bvh
     BV r;
     r.bb = sceneBB;
     bvh_create(&r, numInstances, i, octrRoot, Axis_X);

     //check left has one inst, right has one inst
     ck_assert_int_eq(list_get_num_items(r.left->instances), 1);
     ck_assert_int_eq(list_get_num_items(r.right->instances), 1);
}
END_TEST

int main(int numArgs, char **args) {
     return run_suite(create_suite("bvh", "core", 1, bvhCreateOctree));
}

Vyacheslav


On 14.09.2016 02:26, Eric Ludlam wrote:
> On 09/03/2016 03:56 AM, Vyacheslav Gonakhchyan wrote:
>> typedef PRInt64 PRTime;
>
> I tried this in a short .hpp file in /tmp, and looked in the cache 
> file.  It looks like it saved correctly for me.  Not sure what might 
> transform it into the bad case.
>
> The error case you displayed:
>
> > ((((0) (0) "PRTime")) type (:superclasses ("PRInt64" type (:type
> "class") nil nil) :type "typedef") nil [3439 3462])
>
> is vaguely similar to how the preprocessor handles some named symbols, 
> though that system usually expands correctly, unless you have 
> something special.
>
> It is also possible there is a nugget of code somewhere editing the 
> raw table structures without doing a copy of the tags. Something like 
> this has occasionally popped up, but no one was ever able to reproduce 
> after flushing the cache file.  There is a small bit in the 'save' 
> section that identifies one bad case in preprocessor table and refuses 
> to save. It might be possible to do something similar here, but then 
> your save file would just have missing data, instead of bad data.
>
> Can you reproduce?
>
> You can run 'semantic-sanity-check' in a buffer to make sure that 
> buffer is ok.
>
> If you load semantic/db-debug.el, you can run 
> `semanticdb-database-sanity-check' to see if everything is in order.  
> If this function successfully flags your error (I don't recall the 
> full set of checks it does) and if one or the other isn't to slow, we 
> could augment some operation to identify when the problem shows up. 
> Otherwise, not sure how else I can help.
>
> Eric


------------------------------------------------------------------------------