Uploaded image for project: 'Code Tools'
  1. Code Tools
  2. CODETOOLS-7903952

Improve warning message for undefined struct

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • None
    • None
    • tools
    • None

      When a struct in a C header file is declared but not defined, such as:

          struct foo;

      Since C still allows code that doesn't see the definition of a struct to use pointers of that struct's type, such as 'struct foo* ptr', many library header files omit the definition of structs in order to hide their implementation. Instead, these structs are only mean to be created and destroyed internally by the library.

      Jextract will issue a warning when ran over this header file:

          lib.h:1:8: warning: Skipping foo (type Declared(foo) is not supported)

      The issue here is that, since jextract does not see the definition of 'foo', it can not generate a binding class.This is the expected result for a header file using this pattern, however, to an unsuspecting user, this may look like jextract is not able to fully process the provided header file. This may lead them to think that there is either an issue with jextract (that needs to be reported), or with the way they used jextract.

      Since there is in reality nothing 'wrong' with a header file like this, or with jextract, I think we should relax the message that is printed to a simple note, instead of a warning, and make the message more specific, such as:

          lib.h:1:8: note: struct foo is declared but not define, will not generate bindings for this struct

      On that note, re-examining the wording of other messages that are printed by the UnsupportedFilter class might not be a bad idea too.

            nbenalla Nizar Benalla
            jvernee Jorn Vernee
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: