Subject: bug#6342: 23.2; error writing table of symbols with semantic in cedet

From: Chong Yidong <[email-masked]>
Date: Thu, 03 Jun 2010 13:20:14 -0400

Hi Eric,

Could you take a look at this report about a symbol that Semantic can't
handle?  I just applied your semantic-lex-spp-table-write-slot-value
change that saves a nil instead of erroring on invalid values.

Jonathan Marchand <[email-masked]> writes:

> Hi,
>
> I'm reporting a second bug in cedet in emacs23 (and 24). When editing a
> C file, semantic saves the symbol tables from the include files required
> by the C file in a cache file in order not to process again these files
> when a new instance emacs runs. Sometimes, it happens that semantic is
> not able to get the value of a symbol from a file, and report the error
> to the echo area. As the save process is a task done automaticly on
> iddle, every minutes semantic reports an error on the echo area (which
> is just annoying). In the CVS version of cedet, the problematic symbols
> are still not proceeded, but it doesn't report an error (actually, the
> symbol is just marked as bogus). This is done in the 1.53 revision of
> the semantic-lex-spp.el file of the cvs version
> (http://cedet.cvs.sourceforge.net/viewvc/cedet/cedet/semantic/semantic-lex-spp.el?view=log).
> I provide a patch that follows this fix (without adding the other stuff
> that just do nothing for the moment).
>
> Moreover, I have a backtrace with an example of a symbol that semantic
> can't handle well in file ctype.h (the one in /usr/include/), here is the output :
>
> Error Writing Table: #<semanticdb-table ctype.h>
> Save Error: "\"Error in macro \\\"name\\\"\"": /home/jonathlela/.emacs.d/semanticdb/!usr!include!semantic.cache
>
> Precisely, the error occurs when calling
> semantic-lex-spp-table-write-slot-value with value =
>
> (("__exctype" (spp-arg-list (#1="name") 3728 . 3734) (EXTERN "extern" 3735 . 3741) (INT "int" 3742 . 3745) (symbol "name" 3746 . 3750) (semantic-list "(int)" 3751 . 3756) (symbol "__THROW" 3757 . 3764)) ("isalnum" (spp-arg-list ("c") 5853 . 5856) (symbol "__isctype" 5857 . 5866) (semantic-list "((c), _ISalnum)" 5866 . 5881)) ("isprint" (spp-arg-list ("c") 6123 . 6126) (symbol "__isctype" 6127 . 6136) (semantic-list "((c), _ISprint)" 6136 . 6151)) ("ispunct" (spp-arg-list ("c") 6168 . 6171) (symbol "__isctype" 6172 . 6181) (semantic-list "((c), _ISpunct)" 6181 . 6196)) ("isxdigit" (spp-arg-list ("c") 6304 . 6307) (symbol "__isctype" 6308 . 6317) (semantic-list "((c), _ISxdigit)" 6317 . 6333)) ("_tolower" (spp-arg-list ("c") 7099 . 7102) (semantic-list "((int) (*__ctype_tolower_loc ())[(int) (c)])" 7103 . 7147)) ("toupper" (spp-arg-list ("c") 6855 . 6858) (symbol "__tobody" 6859 . 6867) (semantic-list "(c, toupper, *__ctype_toupper_loc (), (c))" 6868 . 6910)) ("isspace" (spp-arg-list ("c") 6213 . 6216) (symbol "__isctype" 6217 . 6226) (semantic-list "((c), _ISspace)" 6226 . 6241)) ("isgraph" (spp-arg-list ("c") 6078 . 6081) (symbol "__isctype" 6082 . 6091) (semantic-list "((c), _ISgraph)" 6091 . 6106)) ("_CTYPE_H" (number "1" 1003 . 1004)) ("_ISbit" (spp-arg-list ("bit") 1504 . 1509) (semantic-list "(1 << (bit))" 1510 . 1522)) ("__toascii" (spp-arg-list ("c") 3665 . 3668) (semantic-list "((c) & 0x7f)" 3669 . 3681)) ("__tobody" (spp-arg-list ("c" "f" "a" "args") 5305 . 5320) (semantic-list "(__extension__             \\\n   ({ int __res;             \\\n      if (sizeof (c) > 1)            \\\n {              \\\n   if (__builtin_constant_p (c))           \\\n     {              \\\n       int __c = (c);            \\\n       __res = __c < -128 || __c > 255 ? __c : (a)[__c];        \\\n     }              \\\n   else              \\\n     __res = f args;            \\\n }              \\\n      else              \\\n __res = (a)[(int) (c)];            \\\n      __res; }))" 5325 . 5787)) ("isupper" (spp-arg-list ("c") 6258 . 6261) (symbol "__isctype" 6262 . 6271) (semantic-list "((c), _ISupper)" 6271 . 6286)) ("iscntrl" (spp-arg-list ("c") 5943 . 5946) (symbol "__isctype" 5947 . 5956) (semantic-list "((c), _IScntrl)" 5956 . 5971)) ("tolower" (spp-arg-list ("c") 6782 . 6785) (symbol "__tobody" 6786 . 6794) (semantic-list "(c, tolower, *__ctype_tolower_loc (), (c))" 6795 . 6837)) ("toascii" (spp-arg-list ("c") 7062 . 7065) (symbol "__toascii" 7066 . 7075) (semantic-list "(c)" 7076 . 7079)) ("__isctype" (spp-arg-list ("c" "type") 3500 . 3509) (semantic-list "((*__ctype_b_loc ())[(int) (c)] & (unsigned short int) type)" 3514 . 3574)) ("_toupper" (spp-arg-list ("c") 7166 . 7169) (semantic-list "((int) (*__ctype_toupper_loc ())[(int) (c)])" 7170 . 7214)) (#1# symbol "_tolower" 5177 . 5185) ("__isascii" (spp-arg-list ("c") 3593 . 3596) (semantic-list "(((c) & ~0x7f) == 0)" 3597 . 3617)) ("isdigit" (spp-arg-list ("c") 5988 . 5991) (symbol "__isctype" 5992 . 6001) (semantic-list "((c), _ISdigit)" 6001 . 6016)) ("islower" (spp-arg-list ("c") 6033 . 6036) (symbol "__isctype" 6037 . 6046) (semantic-list "((c), _ISlower)" 6046 . 6061)) ("isascii" (spp-arg-list ("c") 7027 . 7030) (symbol "__isascii" 7031 . 7040) (semantic-list "(c)" 7041 . 7044)) ("isalpha" (spp-arg-list ("c") 5898 . 5901) (symbol "__isctype" 5902 . 5911) (semantic-list "((c), _ISalpha)" 5911 . 5926)))
>
> The error is raised when sym =
>
> ("name" symbol "_tolower" 5177 . 5185)
>
> I don't know if someone can do something with these informations, but
> still it may be a good starting point to fix the problem.
>
> Regards,
>
> Jonathan Marchand