Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#89 Wrong parsing of function prototype declarations (C)

closed-fixed
nobody
semantic (53)
5
2008-03-22
2007-11-21
Anonymous
No

(semantic-find-tags-by-class 'function tag-table) returns wrong function info for this prototype:

typedef GLenum (APIENTRYP PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC) (GLenum target);

Output is:

(GLenum function (:arguments ((PFNGLCHECKFRAMEBUFFERSTATUSEXTPROC variable (:type (APIENTRY type (:type class) nil nil)) (reparse-symbol arg-sub-list) #<overlay from 338858 to 338903 in glext.h>)) :type int) nil #<overlay from 338850 to 338919 in glext.h>)

Also it doesn't return info for this prototype at all (and info is not in 'type class):

typedef void (APIENTRYP PFNGLFRAMEBUFFERTEXTURE1DEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level);

But this is ok:

typedef unsigned int ( * PFNGLXGETAGPOFFSETMESAPROC) (const void *pointer);

For this prototype output is correct:

(*PFNGLXGETAGPOFFSETMESAPROC function (:prototype-flag t :arguments ((pointer variable (:pointer 1 :constant-flag t :type void) (reparse-symbol arg-sub-list) #<overlay from 30068 to 30088 in glxext.h>)) :type unsigned int) nil #<overlay from 30022 to 30089 in glxext.h>)

I found this issue while was trying to parse /usr/include/GL/*

p.s.: Emacs 22.1.1, latest semantic from cvs.

Discussion

  • Eric M. Ludlam
    Eric M. Ludlam
    2008-03-02

    Logged In: YES
    user_id=88537
    Originator: NO

    The right way to fix this is for Semantic to parse all header files, and collec the cpp macros so they can be
    substituted in.

    A second way to fix this is to put the key macro values into semantic-lex-c-preprocessor-symbol-map.
    I've got a fix to make "*" be a valid macro value. Need to update the doc and such still.

     
  • Eric M. Ludlam
    Eric M. Ludlam
    2008-03-22

    • status: open --> closed-fixed
     
  • Eric M. Ludlam
    Eric M. Ludlam
    2008-03-22

    Logged In: YES
    user_id=88537
    Originator: NO

    I won't be able to fix the auto-reading of all header files, but you can now stick:

    #define APIENTRYP *

    in this file and fix it, or add a line of lisp to add that t the preprocessor map. The preprocessor handling was checked in earlier today.