[vim/vim] Revamp `make proto` (PR #18045)

40 views
Skip to first unread message

h_east

unread,
Aug 18, 2025, 11:59:15 AMAug 18
to vim/vim, Subscribed

Instead of cproto, use clang.cindex from Python to create prototype declaration files (.pro) from source code.

I'm working on Ubuntu 24.04.

$ sudo apt-get update
$ sudo apt-get install -y python3 python3-pip clang libclang-dev python3-clang

You can view, comment on, or merge this pull request online at:

  https://github.com/vim/vim/pull/18045

Commit Summary

  • c81eed3 Revamp `make proto`
  • 0bef846 Add src/proto/gen_prototypes.py
  • bac2a88 tweak around proto
  • 9e3fedb tweak around proto
  • ed0df52 tweak around proto
  • 7a5188c tweak arounf proto
  • 7806c05 tweak around proto
  • f916ead Make array parameters print as `name[]` (e.g., `char *dirnames[]`) instead of `char *[]name`.
  • ace6c5d - Top-level variadic: when the function type is variadic, change void → `...` or append `, ...`.
  • 141ba6d show libclang diagnostics to stderr for easier troubleshooting, when env GENPROTO_SHOW_DIAGS is true.
  • de34b92 - Respect argument types as defined.

File Changes

(19 files)

Patch Links:


Reply to this email directly, view it on GitHub.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045@github.com>

h_east

unread,
Aug 18, 2025, 12:04:43 PMAug 18
to vim/vim, Subscribed
h-east left a comment (vim/vim#18045)

@chrisbra and Vim members,
What do you think of this approach?
Although make proto depends on python and clang, I think it's better than continuing to use cproto.


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/c3197530099@github.com>

h_east

unread,
Aug 19, 2025, 7:13:00 AMAug 19
to vim/vim, Push

@h-east pushed 11 commits.

  • 3c6de13 Revamp `make proto`
  • e5f6433 Add src/proto/gen_prototypes.py
  • 95cd8e2 tweak around proto
  • 1ce7324 tweak around proto
  • f6010c6 tweak around proto
  • 8d72718 tweak arounf proto
  • 6f1bab1 tweak around proto
  • 20f4a28 Make array parameters print as `name[]` (e.g., `char *dirnames[]`) instead of `char *[]name`.
  • 84ccf02 - Top-level variadic: when the function type is variadic, change void → `...` or append `, ...`.
  • 295acf7 show libclang diagnostics to stderr for easier troubleshooting, when env GENPROTO_SHOW_DIAGS is true.
  • c479d4b - Respect argument types as defined.


View it on GitHub or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/de34b92aa3a61abd1db70416e4b7494c6209b316/after/c479d4bba694a78625e3e7908ccf80dd1c7a6c48@github.com>

h_east

unread,
Aug 19, 2025, 9:37:39 AMAug 19
to vim/vim, Push

@h-east pushed 8 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/c479d4bba694a78625e3e7908ccf80dd1c7a6c48/after/a4dd71be13ef31f194ca44f978860f2e173b00a7@github.com>

h_east

unread,
Aug 19, 2025, 9:47:19 AMAug 19
to vim/vim, Push

@h-east pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/a4dd71be13ef31f194ca44f978860f2e173b00a7/after/20936d007c1bd3130aad93fcf180d0d0ae1e3c5d@github.com>

h_east

unread,
Aug 19, 2025, 10:10:49 AMAug 19
to vim/vim, Push

@h-east pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/20936d007c1bd3130aad93fcf180d0d0ae1e3c5d/after/81487f12397e6b502c9455b76934d83243b278a3@github.com>

Yegappan Lakshmanan

unread,
Aug 19, 2025, 10:43:44 AMAug 19
to vim/vim, Subscribed

@yegappan commented on this pull request.


In src/indent.c:

> @@ -474,7 +474,7 @@ get_indent_str(
     return count;
 }
 
-#ifdef FEAT_VARTABS
+#if defined(FEAT_VARTABS) || defined(PROTO)

One suggestion: it might be easier to track the changes later, if you can separate out the changes related to the "PROTO" checks into one PR and the changes for the new script into another PR.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/review/3132669594@github.com>

h_east

unread,
Aug 19, 2025, 10:56:23 AMAug 19
to vim/vim, Subscribed

@h-east commented on this pull request.


In src/indent.c:

> @@ -474,7 +474,7 @@ get_indent_str(
     return count;
 }
 
-#ifdef FEAT_VARTABS
+#if defined(FEAT_VARTABS) || defined(PROTO)

Around the same time you commented, I submitted a PR implementing your suggestion 👍


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/review/3132720074@github.com>

Yee Cheng Chin

unread,
Aug 19, 2025, 10:04:38 PMAug 19
to vim/vim, Subscribed
ychin left a comment (vim/vim#18045)

Does this work in all platforms? And does it still require us to do all the typedef's in say os_mswin.c (e.g. typedef int BOOL;) or the declarations in struct.h (e.g. typedef long varnumber_T;).

If the answer is no, then I wonder what the point of switching to a separate Python script is?


Reply to this email directly, view it on GitHub.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/c3203894047@github.com>

h_east

unread,
Aug 19, 2025, 11:57:20 PMAug 19
to vim/vim, Subscribed
h-east left a comment (vim/vim#18045)

The answer is “Yes.” I’m still experimenting, but my goal is to get the same output in any environment where Python and Clang are available. It’s impossible to do this with a truly accurate parser, so I’m switching to an approach that detects “something like a function definition” and then generates its prototype declaration as-is.

If this works, we won’t need the PROTO definitions themselves nor the hacky consistency-forcing code for cproto that you mentioned.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/c3204098876@github.com>

h_east

unread,
Aug 20, 2025, 11:39:42 AMAug 20
to vim/vim, Push

@h-east pushed 1 commit.

  • 73d9f17 Switching to an approach that detects "something like a function definition" and then generates its prototype declaration as-is.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/81487f12397e6b502c9455b76934d83243b278a3/after/73d9f1749be94b9c6250cf7a005d1f33d4d0ef8c@github.com>

h_east

unread,
Aug 21, 2025, 6:53:18 AMAug 21
to vim/vim, Push

@h-east pushed 9 commits.

  • c0ff97c Revamp `make proto`
  • 4bb8af1 Add src/proto/gen_prototypes.py
  • 104e29b Make array parameters print as `name[]` (e.g., `char *dirnames[]`) instead of `char *[]name`.
  • dbb93ff - Top-level variadic: when the function type is variadic, change void → `...` or append `, ...`.
  • 18239d4 show libclang diagnostics to stderr for easier troubleshooting, when env GENPROTO_SHOW_DIAGS is true.
  • d77ff3d - Respect argument types as defined.
  • 40881fc tweak script around pointer
  • f2ffcf4 fix makefile
  • 3863053 Switching to an approach that detects "something like a function definition" and then generates its prototype declaration as-is.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/73d9f1749be94b9c6250cf7a005d1f33d4d0ef8c/after/38630530242f59ed2edbc50dd2e1041cb54e0089@github.com>

h_east

unread,
Aug 22, 2025, 8:30:48 PMAug 22
to vim/vim, Push

@h-east pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/19d0395a00de13aee2bf6065955678862b10a439/after/82bcde92b0bdc4bb996b6c521f8018b0c2a763fb@github.com>

h_east

unread,
Sep 1, 2025, 8:08:54 AMSep 1
to vim/vim, Push

@h-east pushed 4 commits.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/82bcde92b0bdc4bb996b6c521f8018b0c2a763fb/after/a487a9b50e8b9d6109657cede877d3264e8b13cc@github.com>

h_east

unread,
Sep 5, 2025, 8:42:32 PM (12 days ago) Sep 5
to vim/vim, Push

@h-east pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/a487a9b50e8b9d6109657cede877d3264e8b13cc/after/d5ebedb083f2de1d469fe610571d2744ba0e091b@github.com>

h_east

unread,
Sep 6, 2025, 3:01:18 PM (11 days ago) Sep 6
to vim/vim, Push

@h-east pushed 1 commit.

  • d53ac84 support `#ifndef PROTO` and `#if !defined(PROTO)`

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/2d254ff491d2a77a11fab6e7fd19bc91b7acfdb7/after/d53ac84164d85a34ccc07a35832d8686129f2a76@github.com>

h_east

unread,
Sep 14, 2025, 10:43:59 AM (4 days ago) Sep 14
to vim/vim, Push

@h-east pushed 4 commits.

  • 10fbe91 Revamp `make proto`
  • f23de23 support `#ifndef PROTO` and `#if !defined(PROTO)`
  • b50fac3 update script
  • 8036c66 Removed error workaround code for `cproto`

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/d53ac84164d85a34ccc07a35832d8686129f2a76/after/8036c661b3914f4f578e32b4f2e3c08bc44b15a1@github.com>

h_east

unread,
Sep 14, 2025, 12:02:35 PM (3 days ago) Sep 14
to vim/vim, Push

@h-east pushed 2 commits.

  • 26c5c85 Removed error workaround code for `cproto`
  • 551bccb update script

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/8036c661b3914f4f578e32b4f2e3c08bc44b15a1/after/551bccb1a7d2fc7f0b09dbbe872a563c61bc8f21@github.com>

h_east

unread,
Sep 14, 2025, 9:44:48 PM (3 days ago) Sep 14
to vim/vim, Push

@h-east pushed 5 commits.

  • 3855da8 Revamp `make proto`
  • c943355 support `#ifndef PROTO` and `#if !defined(PROTO)`
  • 594f59b Removed error workaround code for `cproto`
  • 50f5aba update script
  • c304bb9 update script

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/551bccb1a7d2fc7f0b09dbbe872a563c61bc8f21/after/c304bb9eccfdd10c26ef63fcb490544be4a14afc@github.com>

h_east

unread,
Sep 15, 2025, 5:31:54 PM (2 days ago) Sep 15
to vim/vim, Push

@h-east pushed 1 commit.

You are receiving this because you are subscribed to this thread.Message ID: <vim/vim/pull/18045/before/c304bb9eccfdd10c26ef63fcb490544be4a14afc/after/bb596d45dab118ea7ff8f4da569c0c07b3a41ffe@github.com>

Reply all
Reply to author
Forward
0 new messages