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

Vim fails to build with enabled dynamic Ruby intepreter when compiler flag for C23 standard is set #16575

Open
zdohnal opened this issue Feb 3, 2025 · 0 comments
Labels

Comments

@zdohnal
Copy link
Contributor

zdohnal commented Feb 3, 2025

Steps to reproduce

Vim fails to build if it is configured for dynamically loaded Ruby plugin and C23 compiler flag is set. Steps to reproduce:

$ CFLAGS="${CFLAGS} -std=c23" CXXFLAGS="${CXXFLAGS} -std=c23" ./configure --enable-gui=no --enable-rubyinterp=dynamic
$ make

Here are build errors - the issue is C23 takes function with () as function with no argument, but Vim Ruby plugin code uses this way to declare functions which have a callback function as argument, but different functions with different number of arguments are used as callbacks in those declared functions.

I have tried to fix the issue by #16512 by using variadic arguments for the callback arguments, but this breaks Vim build with dynamically linked Ruby interpreter, because now the function declarations were different than how they are declared in Ruby header.
Ruby header anyargs.h actually generates every function with different number of arguments, and hides all of them under generic public macro, which is called from programs using Ruby, and the correct function is used based on number of arguments - unfortunately I was not able to mimic this macro processing in Vim.

I have worked it around for now by setting -std=c17 for compilation, until someone can come up with better solution.

(The other thing came up to my mind is to #ifdef those functions with variadic arguments specially for dynamically loaded Ruby plugin - if you would prefer this solution, do let me know, I can prepare PR for it)

Expected behaviour

Vim builds with dynamic Ruby plugin under C23.

Version of Vim

Current master patchlevel - 9.1.1071

Environment

OS: Fedora 41
TERM: xterm-256color
Compiler: gcc-14.2.1-7.fc41.x86_64 (but anything with C23 does the trick)
Ruby: ruby-devel-3.3.6-17.fc41.x86_64

Logs and stack traces

@zdohnal zdohnal added the bug label Feb 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant