Open
Description
When trying to run :DogeGenerate on a C function that has a pointer to pointer parameter, the following exception occurs:
Line: "int main(int argc, char **argv)"
Exception: Vim(return):E491: JSON decode error at 'thread 'main' panicked at src/c/parser.rs:69:38:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
'
Helper output: thread 'main' panicked at src/c/parser.rs:69:38:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
Error detected while processing function doge#generate[36]..doge#run_parser[55]..function doge#generate[36]..doge#run_p
arser:
line 50:
[vim-doge] c parser failed
Press ENTER or type command to continue
If we modify the sourcecode and change to a simple pointer (char *argv), it works as expected, only when it's a pointer to a pointer (char **argv) that the problem happens.
To Reproduce
Steps to reproduce the behavior:
- Use the following C code sample:
int main(int argc, char **argv)
{
return 1;
}
- Try to DogeGenerate with the cursor at 1,1
Expected behavior
The doxygen comment, not an exception.
Output of ./bin/vim-doge-helper --version
vim-doge-helper 4.7.0
Output of vim --version
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Jan 8 2025 16:39:01)
Included patches: 1-998
Compiled by laugusto@lab
Huge version without GUI. Features included (+) or not (-):
+acl +file_in_path +mouse_urxvt -tag_any_white
+arabic +find_in_path +mouse_xterm -tcl
+autocmd +float +multi_byte +termguicolors
+autochdir +folding +multi_lang +terminal
-autoservername -footer -mzscheme +terminfo
-balloon_eval +fork() +netbeans_intg +termresponse
+balloon_eval_term +gettext +num64 +textobjects
-browse -hangul_input +packages +textprop
++builtin_terms +iconv +path_extra +timers
+byte_offset +insert_expand -perl +title
+channel +ipv6 +persistent_undo -toolbar
+cindent +job +popupwin +user_commands
+clientserver +jumplist +postscript +vartabs
+clipboard +keymap +printer +vertsplit
+cmdline_compl +lambda +profile +vim9script
+cmdline_hist +langmap -python +viminfo
+cmdline_info +libcall +python3 +virtualedit
+comments +linebreak +quickfix +visual
+conceal +lispindent +reltime +visualextra
+cryptv +listcmds +rightleft +vreplace
+cscope +localmap -ruby +wildignore
+cursorbind -lua +scrollbind +wildmenu
+cursorshape +menu +signs +windows
+dialog_con +mksession +smartindent +writebackup
+diff +modify_fname -sodium +X11
+digraphs +mouse -sound +xattr
-dnd -mouseshape +spell +xfontset
-ebcdic +mouse_dec +startuptime -xim
+emacs_tags -mouse_gpm +statusline +xpm
+eval -mouse_jsbterm -sun_workshop +xsmp_interact
+ex_extra +mouse_netterm +syntax +xterm_clipboard
+extra_search +mouse_sgr +tag_binary -xterm_save
-farsi -mouse_sysmouse -tag_old_static
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
3rd user vimrc file: "~/.config/vim/vimrc"
user exrc file: "$HOME/.exrc"
defaults file: "$VIMRUNTIME/defaults.vim"
fall-back for $VIM: "/usr/local/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -g -O2 -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lrt -ldl -L/usr/lib/python3.8/config-3.8-x86_64-linux-gnu -lpython3.8 -lcrypt -lpthread -ldl -lutil -lm -lm