mirror of
				https://github.com/neovim/neovim.git
				synced 2025-10-26 12:27:24 +00:00 
			
		
		
		
	build: allow comment after #include for required header (#29722)
And also check in .c files, as the attributes may be silently missing there as well.
This commit is contained in:
		| @@ -545,7 +545,6 @@ foreach(sfile ${NVIM_SOURCES} | ||||
|     set(f "${d}/${f}") | ||||
|     set(r "${d}/${r}") | ||||
|   endif() | ||||
|   set (gf_basename "") | ||||
|   if ("${ext}" STREQUAL ".c.h") | ||||
|     continue() # .c.h files are sussy baka, skip | ||||
|   elseif(${sfile} IN_LIST NVIM_HEADERS) | ||||
| @@ -554,6 +553,7 @@ foreach(sfile ${NVIM_SOURCES} | ||||
|     set(gf_h_h "SKIP") | ||||
|     set(gf_h_h_out "") | ||||
|   else() | ||||
|     set(gf_basename "${r}.c.generated.h") | ||||
|     set(gf_c_h "${GENERATED_DIR}/${r}.c.generated.h") | ||||
|     set(gf_h_h "${GENERATED_INCLUDES_DIR}/${r}.h.generated.h") | ||||
|     set(gf_h_h_out "${gf_h_h}") | ||||
|   | ||||
| @@ -208,6 +208,10 @@ if fname:find('.*/src/nvim/.*%.c$') then | ||||
| // IWYU pragma: private, include "%s" | ||||
| ]]):format(header_fname:gsub('.*/src/nvim/', 'nvim/')) .. non_static | ||||
|   end | ||||
| elseif fname:find('.*/src/nvim/.*%.h$') then | ||||
|   static = ([[ | ||||
| // IWYU pragma: private, include "%s" | ||||
| ]]):format(fname:gsub('.*/src/nvim/', 'nvim/')) .. static | ||||
| elseif non_static_fname:find('/include/api/private/dispatch_wrappers%.h%.generated%.h$') then | ||||
|   non_static = [[ | ||||
| // IWYU pragma: private, include "nvim/api/private/dispatch.h" | ||||
| @@ -308,15 +312,18 @@ F = io.open(static_fname, 'w') | ||||
| F:write(static) | ||||
| F:close() | ||||
|  | ||||
| if non_static_fname == 'SKIP' then | ||||
| if any_static then | ||||
|   F = io.open(fname, 'r') | ||||
|   if any_static then | ||||
|     local orig_text = F:read('*a') | ||||
|     local pat = '\n#%s?include%s+"' .. static_basename .. '"\n' | ||||
|     if not string.find(orig_text, pat) then | ||||
|       error('fail: missing include for ' .. static_basename .. ' in ' .. fname) | ||||
|     end | ||||
|   local orig_text = F:read('*a') | ||||
|   local pat = '\n#%s?include%s+"' .. static_basename .. '"\n' | ||||
|   local pat_comment = '\n#%s?include%s+"' .. static_basename .. '"%s*//' | ||||
|   if not string.find(orig_text, pat) and not string.find(orig_text, pat_comment) then | ||||
|     error('fail: missing include for ' .. static_basename .. ' in ' .. fname) | ||||
|   end | ||||
|   F:close() | ||||
| end | ||||
|  | ||||
| if non_static_fname == 'SKIP' then | ||||
|   return -- only want static declarations | ||||
| end | ||||
|  | ||||
| @@ -329,7 +336,7 @@ if F ~= nil then | ||||
|   if F:read('*a') == non_static then | ||||
|     os.exit(0) | ||||
|   end | ||||
|   io.close(F) | ||||
|   F:close() | ||||
| end | ||||
|  | ||||
| F = io.open(non_static_fname, 'w') | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 zeertzjq
					zeertzjq