Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The enum value for CXCursor_TranslationUnit is 350. #61

Merged
merged 1 commit into from
Apr 25, 2023

Conversation

cfis
Copy link
Collaborator

@cfis cfis commented Apr 25, 2023

@ioquatix ioquatix merged commit d76d11f into ioquatix:main Apr 25, 2023
@ioquatix
Copy link
Owner

Thanks.

@ioquatix
Copy link
Owner

I tested this locally on macOS, which as we all know uses a odd release of clang, and it failed, I think it's still expecting the value 300.

Is this just some oddity of Clang on macOS? Or is this some oddity of Clang in general?

In other words, do we need to special case this const value on different clang versions/platforms/releases?

@ioquatix
Copy link
Owner

ioquatix commented Apr 25, 2023

Just FYI:

  23) FFI::Clang::TranslationUnit#cursor returns translation unit cursor if no arguments are specified
      Failure/Error: expect(cursor.kind).to eq(:cursor_translation_unit)
      
        expected: :cursor_translation_unit
             got: 300
      
        (compared using ==)

I'd like to at least figure out what to do before making a new release. Of course, it seems fine on the official releases of clang..........

If you have time, do you mind investigating?

@cfis
Copy link
Collaborator Author

cfis commented Apr 25, 2023

Ok - that value changed June 16, 2022 in this commit:

sx-aurora-dev/llvm-project@bb83f8e

No idea why they would change an existing enum value.

Anyway, that probably means it is in Clang 15 (released Sept 6, 2022) and higher.

One approach is what you said - the latest version of the gem should work with newer versions of Clang, and if you have an older version of Clang than use an older version of the gem.

Alternatively, it would be easy to add a Clang version check in the code that defines the enum based on the Clang version. Similar to what I do in the Proj4rb gem. See:

https://github.com/cfis/proj4rb/blob/master/lib/api/api_6_0.rb#L77

I would take the second approach. Thoughts?

@ioquatix
Copy link
Owner

I suppose macOS is a fairly important target, so the 2nd approach makes more sense to me.

Yeah, it's surprising they'd change an enum value like that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants