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

Fix for get_comments prototype deprecation #186

Merged
merged 1 commit into from
Dec 8, 2023
Merged

Conversation

tmcgilchrist
Copy link
Contributor

🤔 What's changed?

Passing arguments to 'get_comments' without a prototype is deprecated in all versions of C and is not supported in C2x. Most of the other functions here have correct arguments passed to them except get_comments.

⚡️ What's your motivation?

Fixing a bug in Cucumber.ml that depends on gherkin-c/libgherkin.so. I get this warning on macOS Sonoma.

cc -c -Wall -Werror -g -fPIC  -MMD -MP -MF ../objs/ast_builder.d -I ../include -I . ast_builder.c -o ../objs/ast_builder.o
ast_builder.c:250:92: error: passing arguments to 'get_comments' without a prototype is deprecated in all versions of C and is not supported in C2x [-Werror,-Wdeprecated-non-prototype]
        const GherkinDocument* gherkin_document = GherkinDocument_new(feature, get_comments(ast_builder));
                                                                                           ^
ast_builder.c:67:24: error: a function declaration without a prototype is deprecated in all versions of C and is treated as a zero-parameter prototype in C2x, conflicting with a subsequent definition [-Werror,-Wdeprecated-non-prototype]
static const Comments* get_comments();
                       ^
ast_builder.c:489:24: note: conflicting prototype is here
static const Comments* get_comments(AstBuilder* ast_builder) {
                       ^
2 errors generated.
make[1]: *** [../objs/ast_builder.o] Error 1
make: *** [libs] Error 2

Environment:

$ cc --version
Apple clang version 15.0.0 (clang-1500.0.40.1)
Target: x86_64-apple-darwin22.6.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ sw_vers
ProductName:		macOS
ProductVersion:		13.6
BuildVersion:		22G120

🏷️ What kind of change is this?

  • 🐛 Bug fix (non-breaking change which fixes a defect)

♻️ Anything particular you want feedback on?

I have only tested on macOS Sonoma. Testing on other platforms would be useful.

📋 Checklist:

  • I agree to respect and uphold the Cucumber Community Code of Conduct
  • I've changed the behaviour of the code
    • I have added/updated tests to cover my changes.
  • My change requires a change to the documentation.
    • I have updated the documentation accordingly.
  • Users should know about my change
    • I have added an entry to the "Unreleased" section of the CHANGELOG, linking to this pull request.

This text was originally generated from a template, then edited by hand. You can modify the template here.

passing arguments to 'get_comments' without a prototype is deprecated in all versions of C and is not supported in C2x
@mpkorstanje mpkorstanje merged commit 2f04d0a into main Dec 8, 2023
2 checks passed
@mpkorstanje mpkorstanje deleted the tmcgilchrist-patch-1 branch December 8, 2023 18:13
@mpkorstanje
Copy link
Contributor

Cheers! I don't know that much about C but CI is passing and it looks sensible.

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