From 0ef90c13b72b74928bfb3c183c7a5bd7240b51ad Mon Sep 17 00:00:00 2001 From: scott-linder Date: Tue, 25 Feb 2014 15:41:16 -0500 Subject: Removes 'proto' dir See #137 for the issue. Every header in the proto directory was: * Given include guards in the form #ifndef NEOVIM_FILENAME_H #define NEOVIM_FILENAME_H ... #endif /* NEOVIM_FILENAM_H */ * Renamed from *.pro -> *.h * Moved from src/proto/ to src/ This would have caused conficts with some existing headers in src/; rather than merge these conflicts now (which is a whole other can of worms involving multiple and conditional inclusion), any header in src/ with a conflicting name was renamed from *.h -> *_defs.h (which may or may not actually describe its purpose, the change is purely a namespacing issue). Once all of these changes were made a script was developed to determine what #includes needed to be added to each source file to describe its dependencies and allow it to compile; because the script is so short and I'll just list it here: #! /bin/bash cd $(dirname $0) # Scrapes `make` output for provided error messages and outputs #includes # needed to resolve them. # $1 : part of the clang error message between filename and identifier list_missing_includes() { for file_missing_pair in $(CC=clang make 2>&1 >/dev/null | sed -n "s/\/\(.*\.[hc]\).*$1.*'\(.*\)'.*/\1:\2/p"); do fields=(${file_missing_pair//:/ }) source_file=${fields[0]} missing_func=${fields[1]} # Try to find the declaration of the missing function. echo $(basename $source_file) \ \#include \"$(grep -r "\b$missing_func __ARGS" | sed -n "s/.*\/\(.*\)\:.*/\1/p")\" # Remove duplicates done | sort | uniq } echo "Finding missing function prototypes..." list_missing_includes "implicit declaration of function" echo "Finding missing identifier declarations..." list_missing_includes "use of undeclared identifier" Each list of required headers was added by hand in the following format: #include "vim.h" #include "*_defs.h" #include "filename.h" /* All other includes in same module here, in alphabetical order. */ /* All includes from other modules (e.g. "os/*.h") here in alphabetical * order. */ --- src/vim.h | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/vim.h') diff --git a/src/vim.h b/src/vim.h index fab3d70568..75c2b14d38 100644 --- a/src/vim.h +++ b/src/vim.h @@ -6,8 +6,8 @@ * Do ":help credits" in Vim to see a list of people who contributed. */ -#ifndef VIM__H -# define VIM__H +#ifndef NEOVIM_VIM_H +# define NEOVIM_VIM_H /* Included when ported to cmake */ /* This is needed to replace TRUE/FALSE macros by true/false from c99 */ #include @@ -62,7 +62,7 @@ Error: configure did not run properly.Check auto/config.log. # define VIMPACKAGE "vim" #endif -#include "os_unix.h" /* bring lots of system header files */ +#include "os_unix_defs.h" /* bring lots of system header files */ #ifndef __ARGS # if defined(__STDC__) || defined(__GNUC__) || defined(WIN3264) @@ -154,7 +154,7 @@ typedef unsigned long u8char_T; /* long should be 32 bits or more */ #include "ascii.h" #include "keymap.h" -#include "term.h" +#include "term_defs.h" #include "macros.h" #include @@ -1260,9 +1260,9 @@ int vim_memcmp __ARGS((void *, void *, size_t)); typedef struct timeval proftime_T; -/* Include option.h before structs.h, because the number of window-local and +/* Include option_defs.h before structs.h, because the number of window-local and * buffer-local options is used there. */ -#include "option.h" /* options and default values */ +#include "option_defs.h" /* options and default values */ /* Note that gui.h is included by structs.h */ @@ -1412,7 +1412,7 @@ typedef struct timeval proftime_T; typedef int VimClipboard; /* This is required for the prototypes. */ -#include "ex_cmds.h" /* Ex command defines */ +#include "ex_cmds_defs.h" /* Ex command defines */ #include "proto.h" /* function prototypes */ /* This has to go after the include of proto.h, as proto/gui.pro declares @@ -1594,4 +1594,4 @@ typedef int VimClipboard; /* This is required for the prototypes. */ # define SET_NO_HLSEARCH(flag) no_hlsearch = (flag); set_vim_var_nr( \ VV_HLSEARCH, !no_hlsearch) -#endif /* VIM__H */ +#endif /* NEOVIM_VIM_H */ -- cgit