diff options
author | zeertzjq <zeertzjq@outlook.com> | 2023-12-22 13:32:46 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-22 13:32:46 +0800 |
commit | ba0fa4fa197330687b06c74a50b2ccd4800f5881 (patch) | |
tree | 13c4be404f1a3e3480a555d06ff627cb6002c5c4 /src/nvim/generators/gen_api_dispatch.lua | |
parent | 089b934352437ab310a6dd3b138c7ed9445a3d7b (diff) | |
download | rneovim-ba0fa4fa197330687b06c74a50b2ccd4800f5881.tar.gz rneovim-ba0fa4fa197330687b06c74a50b2ccd4800f5881.tar.bz2 rneovim-ba0fa4fa197330687b06c74a50b2ccd4800f5881.zip |
refactor(IWYU): add "private" pragma to more generated headers (#26706)
"export" only prevents IWYU from adding these headers if the headers
that export them are included, while "private" ensures that IWYU never
adds these headers.
Diffstat (limited to 'src/nvim/generators/gen_api_dispatch.lua')
-rw-r--r-- | src/nvim/generators/gen_api_dispatch.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/nvim/generators/gen_api_dispatch.lua b/src/nvim/generators/gen_api_dispatch.lua index 5928999967..791edfff96 100644 --- a/src/nvim/generators/gen_api_dispatch.lua +++ b/src/nvim/generators/gen_api_dispatch.lua @@ -106,7 +106,7 @@ for i = 6, #arg do end headers[#headers + 1] = parts[#parts - 1] .. '/' .. parts[#parts] - local input = io.open(full_path, 'rb') + local input = assert(io.open(full_path, 'rb')) local tmp = c_grammar.grammar:match(input:read('*all')) for j = 1, #tmp do @@ -216,16 +216,16 @@ end -- serialize the API metadata using msgpack and embed into the resulting -- binary for easy querying by clients -local funcs_metadata_output = io.open(funcs_metadata_outputf, 'wb') +local funcs_metadata_output = assert(io.open(funcs_metadata_outputf, 'wb')) local packed = mpack.encode(exported_functions) local dump_bin_array = require('generators.dump_bin_array') dump_bin_array(funcs_metadata_output, 'funcs_metadata', packed) funcs_metadata_output:close() -- start building the dispatch wrapper output -local output = io.open(dispatch_outputf, 'wb') +local output = assert(io.open(dispatch_outputf, 'wb')) -local keysets_defs = io.open(keysets_outputf, 'wb') +local keysets_defs = assert(io.open(keysets_outputf, 'wb')) -- =========================================================================== -- NEW API FILES MUST GO HERE. @@ -257,6 +257,8 @@ output:write([[ ]]) +keysets_defs:write('// IWYU pragma: private, include "nvim/api/private/dispatch.h"\n\n') + for _, k in ipairs(keysets) do local c_name = {} @@ -633,7 +635,7 @@ output:write(hashfun) output:close() functions.keysets = keysets -local mpack_output = io.open(mpack_outputf, 'wb') +local mpack_output = assert(io.open(mpack_outputf, 'wb')) mpack_output:write(mpack.encode(functions)) mpack_output:close() @@ -653,7 +655,7 @@ local function write_shifted_output(_, str) end -- start building lua output -output = io.open(lua_c_bindings_outputf, 'wb') +output = assert(io.open(lua_c_bindings_outputf, 'wb')) output:write([[ #include <lua.h> |