Skip to content

Issue with handling preprocessor attributes #13

Open
@genotrance

Description

@genotrance

For example from libclipboard.h:

LCB_API clipboard_c *LCB_CC clipboard_new(clipboard_opts *cb_opts);

Here, LCB_API is a preprocessor attribute:

#ifdef LIBCLIPBOARD_BUILD_SHARED
#  ifdef clipboard_EXPORTS /* Defined by CMake when we're compiling the shared library */
#    define LCB_API LIBCLIPBOARD_DLL_EXPORT
#  else
#    define LCB_API LIBCLIPBOARD_DLL_IMPORT
#  endif
#  define LCB_LOCAL LIBCLIPBOARD_DLL_LOCAL
#else
#  define LCB_API
#  define LCB_LOCAL
#endif

This results in an ERROR:

(translation_unit 0 71
 (declaration 0 19
  (type_identifier 0 7)
  (identifier 8 19)
 )
 (expression_statement 20 67
  (pointer_expression 20 66
   (ERROR 21 27                             <=====
    (identifier 21 27)
   )
   (call_expression 28 66
    (identifier 28 41)
    (argument_list 41 66
     (math_expression 42 65
      (identifier 42 56)
      (identifier 58 65)
     )
    )
   )
  )
 )
)

LCB_API gets treated as a type rather than a marker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions