{"thread":{"id":"49135","subject":"[PATCHv4 6/6] Remove forward declaration of an enum","startedAt":"2018-08-15T17:54:19Z","lastAt":"2018-08-16T17:48:14Z","messageCount":14,"participants":["Elijah Newren","Jonathan Nieder","Ramsay Jones","Junio C Hamano","Jeff King"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"355722","messageId":"20180815175410.5726-7-newren@gmail.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"[PATCHv4 6/6] Remove forward declaration of an enum","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:10Z","receivedAt":"2018-08-15T17:54:19Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"According to http://c-faq.com/null/machexamp.html, sizeof(char*) !=\nsizeof(int*) on some platforms.  Since an enum could be a char or int\n(or long or...), knowing the size of the enum thus is important to\nknowing the size of a pointer to an enum, so we cannot just forward\ndeclare an enum the way we can a struct.  (Also, modern C++ compilers\napparently define forward declarations of an enum to either be useless\nbecause the enum was defined, or require an explicit size specifier, or\nbe a compilation error.)\n\nHelped-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n packfile.h | 2 +-\n 1 file changed, 1 insertion(+), 1 deletion(-)\n\ndiff --git a/packfile.h b/packfile.h\nindex cc7eaffe1b..fa36c473ad 100644\n--- a/packfile.h\n+++ b/packfile.h\n@@ -1,12 +1,12 @@\n #ifndef PACKFILE_H\n #define PACKFILE_H\n \n+#include \"cache.h\"\n #include \"oidset.h\"\n \n /* in object-store.h */\n struct packed_git;\n struct object_info;\n-enum object_type;\n \n /*\n  * Generate the filename to be used for a pack file with checksum \"sha1\" and\n-- \n2.18.0.553.g74975b7909\n\n"},{"id":"355723","messageId":"20180815175410.5726-5-newren@gmail.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"[PATCHv4 4/6] urlmatch.h: fix include guard","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:08Z","receivedAt":"2018-08-15T17:54:21Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n urlmatch.h | 2 ++\n 1 file changed, 2 insertions(+)\n\ndiff --git a/urlmatch.h b/urlmatch.h\nindex 37ee5da85e..e482148248 100644\n--- a/urlmatch.h\n+++ b/urlmatch.h\n@@ -1,4 +1,6 @@\n #ifndef URL_MATCH_H\n+#define URL_MATCH_H\n+\n #include \"string-list.h\"\n \n struct url_info {\n-- \n2.18.0.553.g74975b7909\n\n"},{"id":"355724","messageId":"20180815175410.5726-3-newren@gmail.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"[PATCHv4 2/6] alloc: make allocate_alloc_state and clear_alloc_state more consistent","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:06Z","receivedAt":"2018-08-15T17:54:25Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Since both functions are using the same data type, they should either both\nrefer to it as void *, or both use the real type (struct alloc_state *).\nOpt for the latter.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n alloc.c | 2 +-\n alloc.h | 2 +-\n 2 files changed, 2 insertions(+), 2 deletions(-)\n\ndiff --git a/alloc.c b/alloc.c\nindex c2fc5d6888..e7aa81b7aa 100644\n--- a/alloc.c\n+++ b/alloc.c\n@@ -36,7 +36,7 @@ struct alloc_state {\n \tint slab_nr, slab_alloc;\n };\n \n-void *allocate_alloc_state(void)\n+struct alloc_state *allocate_alloc_state(void)\n {\n \treturn xcalloc(1, sizeof(struct alloc_state));\n }\ndiff --git a/alloc.h b/alloc.h\nindex 7a41bb9eb3..ba356ed847 100644\n--- a/alloc.h\n+++ b/alloc.h\n@@ -15,7 +15,7 @@ void *alloc_object_node(struct repository *r);\n void alloc_report(struct repository *r);\n unsigned int alloc_commit_index(struct repository *r);\n \n-void *allocate_alloc_state(void);\n+struct alloc_state *allocate_alloc_state(void);\n void clear_alloc_state(struct alloc_state *s);\n \n #endif\n-- \n2.18.0.553.g74975b7909\n\n"},{"id":"355725","messageId":"20180815175410.5726-6-newren@gmail.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"[PATCHv4 5/6] compat/precompose_utf8.h: use more common include guard style","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:09Z","receivedAt":"2018-08-15T17:54:25Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n compat/precompose_utf8.h | 3 ++-\n 1 file changed, 2 insertions(+), 1 deletion(-)\n\ndiff --git a/compat/precompose_utf8.h b/compat/precompose_utf8.h\nindex a94e7c4342..6f843d3e1a 100644\n--- a/compat/precompose_utf8.h\n+++ b/compat/precompose_utf8.h\n@@ -1,4 +1,6 @@\n #ifndef PRECOMPOSE_UNICODE_H\n+#define PRECOMPOSE_UNICODE_H\n+\n #include <sys/stat.h>\n #include <sys/types.h>\n #include <dirent.h>\n@@ -41,5 +43,4 @@ int precompose_utf8_closedir(PREC_DIR *dirp);\n #define DIR PREC_DIR\n #endif /* PRECOMPOSE_UNICODE_C */\n \n-#define  PRECOMPOSE_UNICODE_H\n #endif /* PRECOMPOSE_UNICODE_H */\n-- \n2.18.0.553.g74975b7909\n\n"},{"id":"355726","messageId":"20180815175410.5726-4-newren@gmail.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"[PATCHv4 3/6] Move definition of enum branch_track from cache.h to branch.h","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:07Z","receivedAt":"2018-08-15T17:54:26Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"'branch_track' feels more closely related to branching, and it is\nneeded later in branch.h; rather than #include'ing cache.h in branch.h\nfor this small enum, just move the enum and the external declaration\nfor git_branch_track to branch.h.\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n branch.h      | 11 +++++++++++\n cache.h       | 10 ----------\n config.c      |  1 +\n environment.c |  1 +\n 4 files changed, 13 insertions(+), 10 deletions(-)\n\ndiff --git a/branch.h b/branch.h\nindex 7d9b330eba..5cace4581f 100644\n--- a/branch.h\n+++ b/branch.h\n@@ -3,6 +3,17 @@\n \n struct strbuf;\n \n+enum branch_track {\n+\tBRANCH_TRACK_UNSPECIFIED = -1,\n+\tBRANCH_TRACK_NEVER = 0,\n+\tBRANCH_TRACK_REMOTE,\n+\tBRANCH_TRACK_ALWAYS,\n+\tBRANCH_TRACK_EXPLICIT,\n+\tBRANCH_TRACK_OVERRIDE\n+};\n+\n+extern enum branch_track git_branch_track;\n+\n /* Functions for acting on the information about branches. */\n \n /*\ndiff --git a/cache.h b/cache.h\nindex 8dc7134f00..a1c0c594fb 100644\n--- a/cache.h\n+++ b/cache.h\n@@ -919,15 +919,6 @@ enum log_refs_config {\n };\n extern enum log_refs_config log_all_ref_updates;\n \n-enum branch_track {\n-\tBRANCH_TRACK_UNSPECIFIED = -1,\n-\tBRANCH_TRACK_NEVER = 0,\n-\tBRANCH_TRACK_REMOTE,\n-\tBRANCH_TRACK_ALWAYS,\n-\tBRANCH_TRACK_EXPLICIT,\n-\tBRANCH_TRACK_OVERRIDE\n-};\n-\n enum rebase_setup_type {\n \tAUTOREBASE_NEVER = 0,\n \tAUTOREBASE_LOCAL,\n@@ -944,7 +935,6 @@ enum push_default_type {\n \tPUSH_DEFAULT_UNSPECIFIED\n };\n \n-extern enum branch_track git_branch_track;\n extern enum rebase_setup_type autorebase;\n extern enum push_default_type push_default;\n \ndiff --git a/config.c b/config.c\nindex 66645047eb..66dca7978a 100644\n--- a/config.c\n+++ b/config.c\n@@ -6,6 +6,7 @@\n  *\n  */\n #include \"cache.h\"\n+#include \"branch.h\"\n #include \"config.h\"\n #include \"repository.h\"\n #include \"lockfile.h\"\ndiff --git a/environment.c b/environment.c\nindex 6cf0079389..0c04a6da7a 100644\n--- a/environment.c\n+++ b/environment.c\n@@ -8,6 +8,7 @@\n  * are.\n  */\n #include \"cache.h\"\n+#include \"branch.h\"\n #include \"repository.h\"\n #include \"config.h\"\n #include \"refs.h\"\n-- \n2.18.0.553.g74975b7909\n\n"},{"id":"355727","messageId":"20180815175410.5726-1-newren@gmail.com","threadId":"49135","inReplyTo":"https://public-inbox.org/git/20180813171749.10481-1-newren@gmail.com/","subject":"[PATCHv4 0/6] Add missing includes and forward declares","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:04Z","receivedAt":"2018-08-15T17:54:28Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"This series fixes compilation errors when using a simple test.c file that\nincludes git-compat-util.h and then exactly one other header (and repeating\nthis for different headers of git).\n\nChanges in this series come from Jonathan Nieder's reviews; full\nrange-diff follows below, but in summary:\n\n  - Squashed the final patch from the previous series into the first (Junio\n    already applied a previous round and resolved the simple conflicts with\n    next and pu, so making it easy to drop doesn't save effort anymore.)\n  - Added a new patch to the series removing the forward declaration of\n    an enum, for portability reasons.\n  - Added Jonathan's Reviewed-by on the relevant patches\n  - Remove a few includes and forward declares (which were initially added\n    in previous rounds of this series) that are no longer necessary (due to\n    other includes)\n  - Fixed wording in commit message for patch 1 and added some comments\n    about methodology used to come up with the patch.\n\nElijah Newren (6):\n  Add missing includes and forward declarations\n  alloc: make allocate_alloc_state and clear_alloc_state more consistent\n  Move definition of enum branch_track from cache.h to branch.h\n  urlmatch.h: fix include guard\n  compat/precompose_utf8.h: use more common include guard style\n  Remove forward declaration of an enum\n\n alloc.c                  |  2 +-\n alloc.h                  |  4 +++-\n apply.h                  |  3 +++\n archive.h                |  1 +\n attr.h                   |  1 +\n bisect.h                 |  2 ++\n branch.h                 | 13 +++++++++++++\n bulk-checkin.h           |  2 ++\n cache.h                  | 10 ----------\n column.h                 |  1 +\n commit-graph.h           |  1 +\n compat/precompose_utf8.h |  3 ++-\n config.c                 |  1 +\n config.h                 |  5 +++++\n connected.h              |  1 +\n convert.h                |  2 ++\n csum-file.h              |  2 ++\n diffcore.h               |  4 ++++\n dir-iterator.h           |  2 ++\n environment.c            |  1 +\n fsck.h                   |  1 +\n fsmonitor.h              |  3 +++\n gpg-interface.h          |  2 ++\n khash.h                  |  3 +++\n list-objects-filter.h    |  4 ++++\n list-objects.h           |  4 ++++\n ll-merge.h               |  2 ++\n mailinfo.h               |  2 ++\n mailmap.h                |  2 ++\n merge-recursive.h        |  4 +++-\n notes-merge.h            |  4 ++++\n notes-utils.h            |  3 +++\n notes.h                  |  3 +++\n object-store.h           |  1 +\n object.h                 |  2 ++\n oidmap.h                 |  1 +\n pack-bitmap.h            |  3 +++\n pack-objects.h           |  1 +\n packfile.h               |  2 +-\n patch-ids.h              |  6 ++++++\n path.h                   |  1 +\n pathspec.h               |  2 ++\n pretty.h                 |  4 ++++\n reachable.h              |  2 ++\n reflog-walk.h            |  1 +\n refs.h                   |  2 ++\n remote.h                 |  1 +\n repository.h             |  2 ++\n resolve-undo.h           |  2 ++\n revision.h               |  1 +\n send-pack.h              |  4 ++++\n sequencer.h              |  5 +++++\n shortlog.h               |  2 ++\n submodule.h              | 10 ++++++++--\n tempfile.h               |  1 +\n trailer.h                |  2 ++\n tree-walk.h              |  2 ++\n unpack-trees.h           |  5 ++++-\n url.h                    |  2 ++\n urlmatch.h               |  2 ++\n utf8.h                   |  2 ++\n worktree.h               |  1 +\n 62 files changed, 152 insertions(+), 18 deletions(-)\n\n1:  f7d50cef3b ! 1:  e6a93208b2 Add missing includes and forward declares\n    @@ -1,6 +1,13 @@\n     Author: Elijah Newren <newren@gmail.com>\n     \n    -    Add missing includes and forward declares\n    +    Add missing includes and forward declarations\n    +\n    +    I looped over the toplevel header files, creating a temporary two-line C\n    +    program for each consisting of\n    +      #include \"git-compat-util.h\"\n    +      #include $HEADER\n    +    This patch is the result of manually fixing errors in compiling those\n    +    tiny programs.\n     \n         Signed-off-by: Elijah Newren <newren@gmail.com>\n     \n    @@ -38,15 +45,13 @@\n     --- a/archive.h\n     +++ b/archive.h\n     @@\n    + #ifndef ARCHIVE_H\n    + #define ARCHIVE_H\n      \n    ++#include \"cache.h\"\n      #include \"pathspec.h\"\n      \n    -+struct object_id;\n    -+enum object_type;\n    -+\n      struct archiver_args {\n    - \tconst char *base;\n    - \tsize_t baselen;\n     \n     diff --git a/attr.h b/attr.h\n     --- a/attr.h\n    @@ -60,6 +65,19 @@\n      /*\n       * Given a string, return the gitattribute object that\n     \n    +diff --git a/bisect.h b/bisect.h\n    +--- a/bisect.h\n    ++++ b/bisect.h\n    +@@\n    + #ifndef BISECT_H\n    + #define BISECT_H\n    +\n    ++struct commit_list;\n    ++\n    + /*\n    +  * Find bisection. If something is found, `reaches` will be the number of\n    +  * commits that the best commit reaches. `all` will be the count of\n    +\n     diff --git a/branch.h b/branch.h\n     --- a/branch.h\n     +++ b/branch.h\n    @@ -213,10 +231,6 @@\n      \n     +#include \"cache.h\"\n     +#include \"dir.h\"\n    -+\n    -+struct cache_entry;\n    -+struct index_state;\n    -+struct strbuf;\n     +\n      extern struct trace_key trace_fsmonitor;\n      \n    @@ -428,6 +442,18 @@\n      \tchar magic[4];\n      \tuint16_t version;\n     \n    +diff --git a/pack-objects.h b/pack-objects.h\n    +--- a/pack-objects.h\n    ++++ b/pack-objects.h\n    +@@\n    + #define PACK_OBJECTS_H\n    +\n    + #include \"object-store.h\"\n    ++#include \"pack.h\"\n    +\n    + #define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)\n    +\n    +\n     diff --git a/patch-ids.h b/patch-ids.h\n     --- a/patch-ids.h\n     +++ b/patch-ids.h\n    @@ -464,9 +490,6 @@\n      #ifndef PATHSPEC_H\n      #define PATHSPEC_H\n      \n    -+#include \"string.h\"\n    -+#include \"strings.h\"\n    -+\n     +struct index_state;\n     +\n      /* Pathspec magic */\n2:  e46bf7d601 ! 2:  f199566088 alloc: make allocate_alloc_state and clear_alloc_state more consistent\n    @@ -6,6 +6,7 @@\n         refer to it as void *, or both use the real type (struct alloc_state *).\n         Opt for the latter.\n     \n    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n         Signed-off-by: Elijah Newren <newren@gmail.com>\n     \n     diff --git a/alloc.c b/alloc.c\n3:  aec8ddda59 ! 3:  169c90a96f Move definition of enum branch_track from cache.h to branch.h\n    @@ -7,6 +7,7 @@\n         for this small enum, just move the enum and the external declaration\n         for git_branch_track to branch.h.\n     \n    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n         Signed-off-by: Elijah Newren <newren@gmail.com>\n     \n     diff --git a/branch.h b/branch.h\n4:  14e33fb5ff ! 4:  5a36e50d4d urlmatch.h: fix include guard\n    @@ -2,6 +2,7 @@\n     \n         urlmatch.h: fix include guard\n     \n    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n         Signed-off-by: Elijah Newren <newren@gmail.com>\n     \n     diff --git a/urlmatch.h b/urlmatch.h\n5:  3e02a381af ! 5:  8f247b24a7 compat/precompose_utf8.h: use more common include guard style\n    @@ -2,6 +2,7 @@\n     \n         compat/precompose_utf8.h: use more common include guard style\n     \n    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n         Signed-off-by: Elijah Newren <newren@gmail.com>\n     \n     diff --git a/compat/precompose_utf8.h b/compat/precompose_utf8.h\n6:  aca61bade1 < -:  ---------- Add missing includes and forward declares\n-:  ---------- > 6:  74975b7909 Remove forward declaration of an enum\n\n-- \n2.18.0.553.g74975b7909\n"},{"id":"355728","messageId":"20180815175410.5726-2-newren@gmail.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"[PATCHv4 1/6] Add missing includes and forward declarations","fromName":"Elijah Newren","fromEmail":"newren@gmail.com","sentAt":"2018-08-15T17:54:05Z","receivedAt":"2018-08-15T17:54:29Z","isPatch":false,"sender":{"key":"newren@gmail.com","avatar":"https://avatars.githubusercontent.com/u/5455730?v=4"},"body":"I looped over the toplevel header files, creating a temporary two-line C\nprogram for each consisting of\n  #include \"git-compat-util.h\"\n  #include $HEADER\nThis patch is the result of manually fixing errors in compiling those\ntiny programs.\n\nSigned-off-by: Elijah Newren <newren@gmail.com>\n---\n alloc.h               |  2 ++\n apply.h               |  3 +++\n archive.h             |  1 +\n attr.h                |  1 +\n bisect.h              |  2 ++\n branch.h              |  2 ++\n bulk-checkin.h        |  2 ++\n column.h              |  1 +\n commit-graph.h        |  1 +\n config.h              |  5 +++++\n connected.h           |  1 +\n convert.h             |  2 ++\n csum-file.h           |  2 ++\n diffcore.h            |  4 ++++\n dir-iterator.h        |  2 ++\n fsck.h                |  1 +\n fsmonitor.h           |  3 +++\n gpg-interface.h       |  2 ++\n khash.h               |  3 +++\n list-objects-filter.h |  4 ++++\n list-objects.h        |  4 ++++\n ll-merge.h            |  2 ++\n mailinfo.h            |  2 ++\n mailmap.h             |  2 ++\n merge-recursive.h     |  4 +++-\n notes-merge.h         |  4 ++++\n notes-utils.h         |  3 +++\n notes.h               |  3 +++\n object-store.h        |  1 +\n object.h              |  2 ++\n oidmap.h              |  1 +\n pack-bitmap.h         |  3 +++\n pack-objects.h        |  1 +\n patch-ids.h           |  6 ++++++\n path.h                |  1 +\n pathspec.h            |  2 ++\n pretty.h              |  4 ++++\n reachable.h           |  2 ++\n reflog-walk.h         |  1 +\n refs.h                |  2 ++\n remote.h              |  1 +\n repository.h          |  2 ++\n resolve-undo.h        |  2 ++\n revision.h            |  1 +\n send-pack.h           |  4 ++++\n sequencer.h           |  5 +++++\n shortlog.h            |  2 ++\n submodule.h           | 10 ++++++++--\n tempfile.h            |  1 +\n trailer.h             |  2 ++\n tree-walk.h           |  2 ++\n unpack-trees.h        |  5 ++++-\n url.h                 |  2 ++\n utf8.h                |  2 ++\n worktree.h            |  1 +\n 55 files changed, 132 insertions(+), 4 deletions(-)\n\ndiff --git a/alloc.h b/alloc.h\nindex 3e4e828db4..7a41bb9eb3 100644\n--- a/alloc.h\n+++ b/alloc.h\n@@ -1,9 +1,11 @@\n #ifndef ALLOC_H\n #define ALLOC_H\n \n+struct alloc_state;\n struct tree;\n struct commit;\n struct tag;\n+struct repository;\n \n void *alloc_blob_node(struct repository *r);\n void *alloc_tree_node(struct repository *r);\ndiff --git a/apply.h b/apply.h\nindex b80d8ba736..0b70e1f3f5 100644\n--- a/apply.h\n+++ b/apply.h\n@@ -1,6 +1,9 @@\n #ifndef APPLY_H\n #define APPLY_H\n \n+#include \"lockfile.h\"\n+#include \"string-list.h\"\n+\n enum apply_ws_error_action {\n \tnowarn_ws_error,\n \twarn_on_ws_error,\ndiff --git a/archive.h b/archive.h\nindex 1f9954f7cd..7aba133635 100644\n--- a/archive.h\n+++ b/archive.h\n@@ -1,6 +1,7 @@\n #ifndef ARCHIVE_H\n #define ARCHIVE_H\n \n+#include \"cache.h\"\n #include \"pathspec.h\"\n \n struct archiver_args {\ndiff --git a/attr.h b/attr.h\nindex 442d464db6..3185538bda 100644\n--- a/attr.h\n+++ b/attr.h\n@@ -7,6 +7,7 @@ struct git_attr;\n /* opaque structures used internally for attribute collection */\n struct all_attrs_item;\n struct attr_stack;\n+struct index_state;\n \n /*\n  * Given a string, return the gitattribute object that\ndiff --git a/bisect.h b/bisect.h\nindex a5d9248a47..34df209351 100644\n--- a/bisect.h\n+++ b/bisect.h\n@@ -1,6 +1,8 @@\n #ifndef BISECT_H\n #define BISECT_H\n \n+struct commit_list;\n+\n /*\n  * Find bisection. If something is found, `reaches` will be the number of\n  * commits that the best commit reaches. `all` will be the count of\ndiff --git a/branch.h b/branch.h\nindex 473d0a93e9..7d9b330eba 100644\n--- a/branch.h\n+++ b/branch.h\n@@ -1,6 +1,8 @@\n #ifndef BRANCH_H\n #define BRANCH_H\n \n+struct strbuf;\n+\n /* Functions for acting on the information about branches. */\n \n /*\ndiff --git a/bulk-checkin.h b/bulk-checkin.h\nindex a85527318b..f438f93811 100644\n--- a/bulk-checkin.h\n+++ b/bulk-checkin.h\n@@ -4,6 +4,8 @@\n #ifndef BULK_CHECKIN_H\n #define BULK_CHECKIN_H\n \n+#include \"cache.h\"\n+\n extern int index_bulk_checkin(struct object_id *oid,\n \t\t\t      int fd, size_t size, enum object_type type,\n \t\t\t      const char *path, unsigned flags);\ndiff --git a/column.h b/column.h\nindex 0a61917fa7..2567a5cf4d 100644\n--- a/column.h\n+++ b/column.h\n@@ -36,6 +36,7 @@ static inline int column_active(unsigned int colopts)\n \treturn (colopts & COL_ENABLE_MASK) == COL_ENABLED;\n }\n \n+struct string_list;\n extern void print_columns(const struct string_list *list, unsigned int colopts,\n \t\t\t  const struct column_options *opts);\n \ndiff --git a/commit-graph.h b/commit-graph.h\nindex 76e098934a..eea62f8c0e 100644\n--- a/commit-graph.h\n+++ b/commit-graph.h\n@@ -4,6 +4,7 @@\n #include \"git-compat-util.h\"\n #include \"repository.h\"\n #include \"string-list.h\"\n+#include \"cache.h\"\n \n struct commit;\n \ndiff --git a/config.h b/config.h\nindex bb2f506b27..75ba1d45ff 100644\n--- a/config.h\n+++ b/config.h\n@@ -1,6 +1,11 @@\n #ifndef CONFIG_H\n #define CONFIG_H\n \n+#include \"hashmap.h\"\n+#include \"string-list.h\"\n+\n+struct object_id;\n+\n /* git_config_parse_key() returns these negated: */\n #define CONFIG_INVALID_KEY 1\n #define CONFIG_NO_SECTION_OR_NAME 2\ndiff --git a/connected.h b/connected.h\nindex 322dc76372..e4c961817d 100644\n--- a/connected.h\n+++ b/connected.h\n@@ -1,6 +1,7 @@\n #ifndef CONNECTED_H\n #define CONNECTED_H\n \n+struct object_id;\n struct transport;\n \n /*\ndiff --git a/convert.h b/convert.h\nindex 01385d9288..76c654385d 100644\n--- a/convert.h\n+++ b/convert.h\n@@ -7,6 +7,8 @@\n #include \"string-list.h\"\n \n struct index_state;\n+struct object_id;\n+struct strbuf;\n \n #define CONV_EOL_RNDTRP_DIE   (1<<0) /* Die if CRLF to LF to CRLF is different */\n #define CONV_EOL_RNDTRP_WARN  (1<<1) /* Warn if CRLF to LF to CRLF is different */\ndiff --git a/csum-file.h b/csum-file.h\nindex c5a2e335e7..3bf7184736 100644\n--- a/csum-file.h\n+++ b/csum-file.h\n@@ -1,6 +1,8 @@\n #ifndef CSUM_FILE_H\n #define CSUM_FILE_H\n \n+#include \"hash.h\"\n+\n struct progress;\n \n /* A SHA1-protected file */\ndiff --git a/diffcore.h b/diffcore.h\nindex a30da161da..0dd1e9a63a 100644\n--- a/diffcore.h\n+++ b/diffcore.h\n@@ -4,6 +4,10 @@\n #ifndef DIFFCORE_H\n #define DIFFCORE_H\n \n+#include \"cache.h\"\n+\n+struct diff_options;\n+\n /* This header file is internal between diff.c and its diff transformers\n  * (e.g. diffcore-rename, diffcore-pickaxe).  Never include this header\n  * in anything else.\ndiff --git a/dir-iterator.h b/dir-iterator.h\nindex 27739e6c29..970793d07a 100644\n--- a/dir-iterator.h\n+++ b/dir-iterator.h\n@@ -1,6 +1,8 @@\n #ifndef DIR_ITERATOR_H\n #define DIR_ITERATOR_H\n \n+#include \"strbuf.h\"\n+\n /*\n  * Iterate over a directory tree.\n  *\ndiff --git a/fsck.h b/fsck.h\nindex c3cf5e0034..0c7e8c9428 100644\n--- a/fsck.h\n+++ b/fsck.h\n@@ -6,6 +6,7 @@\n #define FSCK_IGNORE 3\n \n struct fsck_options;\n+struct object;\n \n void fsck_set_msg_type(struct fsck_options *options,\n \t\tconst char *msg_id, const char *msg_type);\ndiff --git a/fsmonitor.h b/fsmonitor.h\nindex 65f3743636..01017c43aa 100644\n--- a/fsmonitor.h\n+++ b/fsmonitor.h\n@@ -1,6 +1,9 @@\n #ifndef FSMONITOR_H\n #define FSMONITOR_H\n \n+#include \"cache.h\"\n+#include \"dir.h\"\n+\n extern struct trace_key trace_fsmonitor;\n \n /*\ndiff --git a/gpg-interface.h b/gpg-interface.h\nindex 5ecff4aa0c..acf50c4610 100644\n--- a/gpg-interface.h\n+++ b/gpg-interface.h\n@@ -1,6 +1,8 @@\n #ifndef GPG_INTERFACE_H\n #define GPG_INTERFACE_H\n \n+struct strbuf;\n+\n #define GPG_VERIFY_VERBOSE\t\t1\n #define GPG_VERIFY_RAW\t\t\t2\n #define GPG_VERIFY_OMIT_STATUS\t4\ndiff --git a/khash.h b/khash.h\nindex c0da40daa7..07b4cc2e67 100644\n--- a/khash.h\n+++ b/khash.h\n@@ -26,6 +26,9 @@\n #ifndef __AC_KHASH_H\n #define __AC_KHASH_H\n \n+#include \"cache.h\"\n+#include \"hashmap.h\"\n+\n #define AC_VERSION_KHASH_H \"0.2.8\"\n \n typedef uint32_t khint32_t;\ndiff --git a/list-objects-filter.h b/list-objects-filter.h\nindex a963d0274c..a6f6b4990b 100644\n--- a/list-objects-filter.h\n+++ b/list-objects-filter.h\n@@ -1,6 +1,10 @@\n #ifndef LIST_OBJECTS_FILTER_H\n #define LIST_OBJECTS_FILTER_H\n \n+struct list_objects_filter_options;\n+struct object;\n+struct oidset;\n+\n /*\n  * During list-object traversal we allow certain objects to be\n  * filtered (omitted) from the result.  The active filter uses\ndiff --git a/list-objects.h b/list-objects.h\nindex aa618d7f45..ad40762926 100644\n--- a/list-objects.h\n+++ b/list-objects.h\n@@ -1,6 +1,10 @@\n #ifndef LIST_OBJECTS_H\n #define LIST_OBJECTS_H\n \n+struct commit;\n+struct object;\n+struct rev_info;\n+\n typedef void (*show_commit_fn)(struct commit *, void *);\n typedef void (*show_object_fn)(struct object *, const char *, void *);\n void traverse_commit_list(struct rev_info *, show_commit_fn, show_object_fn, void *);\ndiff --git a/ll-merge.h b/ll-merge.h\nindex 244a31f55a..b72b19921e 100644\n--- a/ll-merge.h\n+++ b/ll-merge.h\n@@ -5,6 +5,8 @@\n #ifndef LL_MERGE_H\n #define LL_MERGE_H\n \n+#include \"xdiff/xdiff.h\"\n+\n struct ll_merge_options {\n \tunsigned virtual_ancestor : 1;\n \tunsigned variant : 2;\t/* favor ours, favor theirs, or union merge */\ndiff --git a/mailinfo.h b/mailinfo.h\nindex 04a25351d6..766c03dd1d 100644\n--- a/mailinfo.h\n+++ b/mailinfo.h\n@@ -1,6 +1,8 @@\n #ifndef MAILINFO_H\n #define MAILINFO_H\n \n+#include \"strbuf.h\"\n+\n #define MAX_BOUNDARIES 5\n \n struct mailinfo {\ndiff --git a/mailmap.h b/mailmap.h\nindex ed7c93b05c..d0e65646cb 100644\n--- a/mailmap.h\n+++ b/mailmap.h\n@@ -1,6 +1,8 @@\n #ifndef MAILMAP_H\n #define MAILMAP_H\n \n+struct string_list;\n+\n int read_mailmap(struct string_list *map, char **repo_abbrev);\n void clear_mailmap(struct string_list *map);\n \ndiff --git a/merge-recursive.h b/merge-recursive.h\nindex fa7bc6b683..0c46a5a4ff 100644\n--- a/merge-recursive.h\n+++ b/merge-recursive.h\n@@ -1,8 +1,10 @@\n #ifndef MERGE_RECURSIVE_H\n #define MERGE_RECURSIVE_H\n \n-#include \"unpack-trees.h\"\n #include \"string-list.h\"\n+#include \"unpack-trees.h\"\n+\n+struct commit;\n \n struct merge_options {\n \tconst char *ancestor;\ndiff --git a/notes-merge.h b/notes-merge.h\nindex f815f23451..6c74e9385b 100644\n--- a/notes-merge.h\n+++ b/notes-merge.h\n@@ -2,6 +2,10 @@\n #define NOTES_MERGE_H\n \n #include \"notes-utils.h\"\n+#include \"strbuf.h\"\n+\n+struct commit;\n+struct object_id;\n \n #define NOTES_MERGE_WORKTREE \"NOTES_MERGE_WORKTREE\"\n \ndiff --git a/notes-utils.h b/notes-utils.h\nindex 5d79cbef51..5408306528 100644\n--- a/notes-utils.h\n+++ b/notes-utils.h\n@@ -3,6 +3,9 @@\n \n #include \"notes.h\"\n \n+struct commit_list;\n+struct object_id;\n+\n /*\n  * Create new notes commit from the given notes tree\n  *\ndiff --git a/notes.h b/notes.h\nindex 0433f45db5..414bc6855a 100644\n--- a/notes.h\n+++ b/notes.h\n@@ -3,6 +3,9 @@\n \n #include \"string-list.h\"\n \n+struct object_id;\n+struct strbuf;\n+\n /*\n  * Function type for combining two notes annotating the same object.\n  *\ndiff --git a/object-store.h b/object-store.h\nindex e481f7ad41..b6f2c732c4 100644\n--- a/object-store.h\n+++ b/object-store.h\n@@ -1,6 +1,7 @@\n #ifndef OBJECT_STORE_H\n #define OBJECT_STORE_H\n \n+#include \"cache.h\"\n #include \"oidmap.h\"\n #include \"list.h\"\n #include \"sha1-array.h\"\ndiff --git a/object.h b/object.h\nindex 177b1a4571..6e28fdd0b4 100644\n--- a/object.h\n+++ b/object.h\n@@ -1,6 +1,8 @@\n #ifndef OBJECT_H\n #define OBJECT_H\n \n+#include \"cache.h\"\n+\n struct buffer_slab;\n \n struct parsed_object_pool {\ndiff --git a/oidmap.h b/oidmap.h\nindex d3cd2bb590..72430b611e 100644\n--- a/oidmap.h\n+++ b/oidmap.h\n@@ -1,6 +1,7 @@\n #ifndef OIDMAP_H\n #define OIDMAP_H\n \n+#include \"cache.h\"\n #include \"hashmap.h\"\n \n /*\ndiff --git a/pack-bitmap.h b/pack-bitmap.h\nindex 4555907dee..8a04741e12 100644\n--- a/pack-bitmap.h\n+++ b/pack-bitmap.h\n@@ -5,6 +5,9 @@\n #include \"khash.h\"\n #include \"pack-objects.h\"\n \n+struct commit;\n+struct rev_info;\n+\n struct bitmap_disk_header {\n \tchar magic[4];\n \tuint16_t version;\ndiff --git a/pack-objects.h b/pack-objects.h\nindex edf74dabdd..08c6b57d49 100644\n--- a/pack-objects.h\n+++ b/pack-objects.h\n@@ -2,6 +2,7 @@\n #define PACK_OBJECTS_H\n \n #include \"object-store.h\"\n+#include \"pack.h\"\n \n #define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)\n \ndiff --git a/patch-ids.h b/patch-ids.h\nindex bec0f727a7..79ac9a8498 100644\n--- a/patch-ids.h\n+++ b/patch-ids.h\n@@ -1,6 +1,12 @@\n #ifndef PATCH_IDS_H\n #define PATCH_IDS_H\n \n+#include \"diff.h\"\n+#include \"hashmap.h\"\n+\n+struct commit;\n+struct object_id;\n+\n struct patch_id {\n \tstruct hashmap_entry ent;\n \tstruct object_id patch_id;\ndiff --git a/path.h b/path.h\nindex ed6732e5a2..b654ea8ff5 100644\n--- a/path.h\n+++ b/path.h\n@@ -2,6 +2,7 @@\n #define PATH_H\n \n struct repository;\n+struct strbuf;\n \n /*\n  * The result to all functions which return statically allocated memory may be\ndiff --git a/pathspec.h b/pathspec.h\nindex 099a170c2e..a6525a6551 100644\n--- a/pathspec.h\n+++ b/pathspec.h\n@@ -1,6 +1,8 @@\n #ifndef PATHSPEC_H\n #define PATHSPEC_H\n \n+struct index_state;\n+\n /* Pathspec magic */\n #define PATHSPEC_FROMTOP\t(1<<0)\n #define PATHSPEC_MAXDEPTH\t(1<<1)\ndiff --git a/pretty.h b/pretty.h\nindex 5c85d94e33..7359d318a9 100644\n--- a/pretty.h\n+++ b/pretty.h\n@@ -1,7 +1,11 @@\n #ifndef PRETTY_H\n #define PRETTY_H\n \n+#include \"cache.h\"\n+#include \"string-list.h\"\n+\n struct commit;\n+struct strbuf;\n \n /* Commit formats */\n enum cmit_fmt {\ndiff --git a/reachable.h b/reachable.h\nindex 3c00fa0526..18b0f9f2f0 100644\n--- a/reachable.h\n+++ b/reachable.h\n@@ -2,6 +2,8 @@\n #define REACHEABLE_H\n \n struct progress;\n+struct rev_info;\n+\n extern int add_unseen_recent_objects_to_traversal(struct rev_info *revs,\n \t\t\t\t\t\t  timestamp_t timestamp);\n extern void mark_reachable_objects(struct rev_info *revs, int mark_reflog,\ndiff --git a/reflog-walk.h b/reflog-walk.h\nindex 7553c448fe..cb3e73755d 100644\n--- a/reflog-walk.h\n+++ b/reflog-walk.h\n@@ -3,6 +3,7 @@\n \n #include \"cache.h\"\n \n+struct commit;\n struct reflog_walk_info;\n \n extern void init_reflog_walk(struct reflog_walk_info **info);\ndiff --git a/refs.h b/refs.h\nindex cc2fb4c68c..bd52c1bbae 100644\n--- a/refs.h\n+++ b/refs.h\n@@ -3,8 +3,10 @@\n \n struct object_id;\n struct ref_store;\n+struct repository;\n struct strbuf;\n struct string_list;\n+struct string_list_item;\n struct worktree;\n \n /*\ndiff --git a/remote.h b/remote.h\nindex 976292152c..88f8480c71 100644\n--- a/remote.h\n+++ b/remote.h\n@@ -1,6 +1,7 @@\n #ifndef REMOTE_H\n #define REMOTE_H\n \n+#include \"cache.h\"\n #include \"parse-options.h\"\n #include \"hashmap.h\"\n #include \"refspec.h\"\ndiff --git a/repository.h b/repository.h\nindex b9413be50c..13c8799678 100644\n--- a/repository.h\n+++ b/repository.h\n@@ -1,6 +1,8 @@\n #ifndef REPOSITORY_H\n #define REPOSITORY_H\n \n+#include \"path.h\"\n+\n struct config_set;\n struct git_hash_algo;\n struct index_state;\ndiff --git a/resolve-undo.h b/resolve-undo.h\nindex 87291904bd..fbe348efac 100644\n--- a/resolve-undo.h\n+++ b/resolve-undo.h\n@@ -1,6 +1,8 @@\n #ifndef RESOLVE_UNDO_H\n #define RESOLVE_UNDO_H\n \n+#include \"cache.h\"\n+\n struct resolve_undo_info {\n \tunsigned int mode[3];\n \tstruct object_id oid[3];\ndiff --git a/revision.h b/revision.h\nindex c599c34da9..850e508783 100644\n--- a/revision.h\n+++ b/revision.h\n@@ -1,6 +1,7 @@\n #ifndef REVISION_H\n #define REVISION_H\n \n+#include \"commit.h\"\n #include \"parse-options.h\"\n #include \"grep.h\"\n #include \"notes.h\"\ndiff --git a/send-pack.h b/send-pack.h\nindex 6af71f7008..e148fcd960 100644\n--- a/send-pack.h\n+++ b/send-pack.h\n@@ -3,6 +3,10 @@\n \n #include \"string-list.h\"\n \n+struct child_process;\n+struct oid_array;\n+struct ref;\n+\n /* Possible values for push_cert field in send_pack_args. */\n #define SEND_PACK_PUSH_CERT_NEVER 0\n #define SEND_PACK_PUSH_CERT_IF_ASKED 1\ndiff --git a/sequencer.h b/sequencer.h\nindex c5787c6b56..c751c9d6e4 100644\n--- a/sequencer.h\n+++ b/sequencer.h\n@@ -1,6 +1,11 @@\n #ifndef SEQUENCER_H\n #define SEQUENCER_H\n \n+#include \"cache.h\"\n+#include \"strbuf.h\"\n+\n+struct commit;\n+\n const char *git_path_commit_editmsg(void);\n const char *git_path_seq_dir(void);\n \ndiff --git a/shortlog.h b/shortlog.h\nindex 5d64cfe929..2fa61c4294 100644\n--- a/shortlog.h\n+++ b/shortlog.h\n@@ -3,6 +3,8 @@\n \n #include \"string-list.h\"\n \n+struct commit;\n+\n struct shortlog {\n \tstruct string_list list;\n \tint summary;\ndiff --git a/submodule.h b/submodule.h\nindex 4644683e6c..3adbc08915 100644\n--- a/submodule.h\n+++ b/submodule.h\n@@ -1,11 +1,17 @@\n #ifndef SUBMODULE_H\n #define SUBMODULE_H\n \n-struct repository;\n-struct diff_options;\n struct argv_array;\n+struct cache_entry;\n+struct diff_options;\n+struct index_state;\n+struct object_id;\n struct oid_array;\n+struct pathspec;\n struct remote;\n+struct repository;\n+struct string_list;\n+struct strbuf;\n \n enum {\n \tRECURSE_SUBMODULES_ONLY = -5,\ndiff --git a/tempfile.h b/tempfile.h\nindex 8959c5f1b5..36434eb6fa 100644\n--- a/tempfile.h\n+++ b/tempfile.h\n@@ -2,6 +2,7 @@\n #define TEMPFILE_H\n \n #include \"list.h\"\n+#include \"strbuf.h\"\n \n /*\n  * Handle temporary files.\ndiff --git a/trailer.h b/trailer.h\nindex 6d7f8c2a52..9c10026c35 100644\n--- a/trailer.h\n+++ b/trailer.h\n@@ -3,6 +3,8 @@\n \n #include \"list.h\"\n \n+struct strbuf;\n+\n enum trailer_where {\n \tWHERE_DEFAULT,\n \tWHERE_END,\ndiff --git a/tree-walk.h b/tree-walk.h\nindex 805f58f00f..196831007e 100644\n--- a/tree-walk.h\n+++ b/tree-walk.h\n@@ -1,6 +1,8 @@\n #ifndef TREE_WALK_H\n #define TREE_WALK_H\n \n+struct strbuf;\n+\n struct name_entry {\n \tconst struct object_id *oid;\n \tconst char *path;\ndiff --git a/unpack-trees.h b/unpack-trees.h\nindex c2b434c606..48bc69cb47 100644\n--- a/unpack-trees.h\n+++ b/unpack-trees.h\n@@ -1,11 +1,14 @@\n #ifndef UNPACK_TREES_H\n #define UNPACK_TREES_H\n \n-#include \"tree-walk.h\"\n+#include \"cache.h\"\n #include \"argv-array.h\"\n+#include \"string-list.h\"\n+#include \"tree-walk.h\"\n \n #define MAX_UNPACK_TREES 8\n \n+struct cache_entry;\n struct unpack_trees_options;\n struct exclude_list;\n \ndiff --git a/url.h b/url.h\nindex abdaf6fa30..f311c40a46 100644\n--- a/url.h\n+++ b/url.h\n@@ -1,6 +1,8 @@\n #ifndef URL_H\n #define URL_H\n \n+struct strbuf;\n+\n extern int is_url(const char *url);\n extern int is_urlschemechar(int first_flag, int ch);\n extern char *url_decode(const char *url);\ndiff --git a/utf8.h b/utf8.h\nindex db73a2d8d3..dd5ee1052a 100644\n--- a/utf8.h\n+++ b/utf8.h\n@@ -1,6 +1,8 @@\n #ifndef GIT_UTF8_H\n #define GIT_UTF8_H\n \n+struct strbuf;\n+\n typedef unsigned int ucs_char_t;  /* assuming 32bit int */\n \n size_t display_mode_esc_sequence_len(const char *s);\ndiff --git a/worktree.h b/worktree.h\nindex fe38ce10c3..df3fc30f73 100644\n--- a/worktree.h\n+++ b/worktree.h\n@@ -1,6 +1,7 @@\n #ifndef WORKTREE_H\n #define WORKTREE_H\n \n+#include \"cache.h\"\n #include \"refs.h\"\n \n struct strbuf;\n-- \n2.18.0.553.g74975b7909\n\n"},{"id":"355756","messageId":"20180815203634.GA181377@aiede.svl.corp.google.com","threadId":"49135","inReplyTo":"20180815175410.5726-2-newren@gmail.com","subject":"Re: [PATCHv4 1/6] Add missing includes and forward declarations","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-15T20:36:34Z","receivedAt":"2018-08-15T20:36:38Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Elijah Newren wrote:\n\n[...]\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n> ---\n[...]\n>  55 files changed, 132 insertions(+), 4 deletions(-)\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks.\n"},{"id":"355757","messageId":"20180815203735.GB181377@aiede.svl.corp.google.com","threadId":"49135","inReplyTo":"20180815175410.5726-3-newren@gmail.com","subject":"Re: [PATCHv4 2/6] alloc: make allocate_alloc_state and clear_alloc_state more consistent","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-15T20:37:35Z","receivedAt":"2018-08-15T20:37:39Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Elijah Newren wrote:\n\n> Since both functions are using the same data type, they should either both\n> refer to it as void *, or both use the real type (struct alloc_state *).\n> Opt for the latter.\n>\n> Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n> Signed-off-by: Elijah Newren <newren@gmail.com>\n\nNot worth rerolling for this, but these usually go in the opposite\norder to reflect the chronology:\n\n  Signed-off-by: Elijah Newren <newren@gmail.com>\n  Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThe patch still looks good to me. :)\n"},{"id":"355758","messageId":"20180815204030.GC181377@aiede.svl.corp.google.com","threadId":"49135","inReplyTo":"20180815175410.5726-7-newren@gmail.com","subject":"Re: [PATCHv4 6/6] Remove forward declaration of an enum","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-15T20:40:30Z","receivedAt":"2018-08-15T20:40:34Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Elijah Newren wrote:\n\n> According to http://c-faq.com/null/machexamp.html, sizeof(char*) !=\n> sizeof(int*) on some platforms.  Since an enum could be a char or int\n> (or long or...), knowing the size of the enum thus is important to\n> knowing the size of a pointer to an enum, so we cannot just forward\n> declare an enum the way we can a struct.  (Also, modern C++ compilers\n> apparently define forward declarations of an enum to either be useless\n> because the enum was defined, or require an explicit size specifier, or\n> be a compilation error.)\n\nBeyond the effect on some obscure platforms, this also makes it\npossible to build with gcc -pedantic (which can be useful for finding\nsome other problems).  Thanks for fixing it.\n\n[...]\n> --- a/packfile.h\n> +++ b/packfile.h\n> @@ -1,12 +1,12 @@\n>  #ifndef PACKFILE_H\n>  #define PACKFILE_H\n>  \n> +#include \"cache.h\"\n>  #include \"oidset.h\"\n>  \n>  /* in object-store.h */\n>  struct packed_git;\n>  struct object_info;\n\nNot about this patch: comments like the above are likely to go stale,\nsince nothing verifies they continue to be true.  So we should remove\nthem. #leftoverbits\n\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n"},{"id":"355759","messageId":"20180815204152.GD181377@aiede.svl.corp.google.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"Re: [PATCHv4 0/6] Add missing includes and forward declares","fromName":"Jonathan Nieder","fromEmail":"jrnieder@gmail.com","sentAt":"2018-08-15T20:41:52Z","receivedAt":"2018-08-15T20:41:57Z","isPatch":false,"sender":{"key":"jrnieder@gmail.com","avatar":"https://avatars.githubusercontent.com/u/281595?v=4"},"body":"Elijah Newren wrote:\n\n>  62 files changed, 152 insertions(+), 18 deletions(-)\n\nAll 6 patches in this series are\nReviewed-by: Jonathan Nieder <jrnieder@gmail.com>\n\nThanks for your patient work.\n\nPointer to previous rounds for the curious:\nhttps://public-inbox.org/git/20180811043218.31456-1-newren@gmail.com/\n"},{"id":"355786","messageId":"b8553a50-6b97-2b45-2f7b-cfe2576548cb@ramsayjones.plus.com","threadId":"49135","inReplyTo":"20180815175410.5726-1-newren@gmail.com","subject":"Re: [PATCHv4 0/6] Add missing includes and forward declares","fromName":"Ramsay Jones","fromEmail":"ramsay@ramsayjones.plus.com","sentAt":"2018-08-16T00:19:17Z","receivedAt":"2018-08-16T00:19:23Z","isPatch":false,"sender":{"key":"ramsay@ramsayjones.plus.com","avatar":"https://avatars.githubusercontent.com/u/33702710?v=4"},"body":"\n\nOn 15/08/18 18:54, Elijah Newren wrote:\n> This series fixes compilation errors when using a simple test.c file that\n> includes git-compat-util.h and then exactly one other header (and repeating\n> this for different headers of git).\n> \n[snip]\n\n> 1:  f7d50cef3b ! 1:  e6a93208b2 Add missing includes and forward declares\n>     @@ -1,6 +1,13 @@\n>      Author: Elijah Newren <newren@gmail.com>\n>      \n>     -    Add missing includes and forward declares\n>     +    Add missing includes and forward declarations\n>     +\n>     +    I looped over the toplevel header files, creating a temporary two-line C\n>     +    program for each consisting of\n>     +      #include \"git-compat-util.h\"\n>     +      #include $HEADER\n>     +    This patch is the result of manually fixing errors in compiling those\n>     +    tiny programs.\n\nAs a quick (\"just before bedtime\") exercise, I tried adding\na Makefile target to perform a similar check. The result is\ngiven below, but I haven't had time to look too closely at\nthe results:\n\n  $ make -k hdr-check >zzz 2>&1\n  $ grep error zzz | wc -l\n  18\n  $ grep warning zzz | wc -l\n  21\n  $ grep error zzz | cut -d: -f1 | grep -v make | uniq -c | sort -nr\n       11 refs/refs-internal.h\n        2 unicode-width.h\n        2 json-writer.h\n        1 refs/ref-cache.h\n        1 commit-slab-impl.h\n  $ grep warning zzz | cut -d: -f1 | grep -v make | uniq -c | sort -nr\n        7 refs/refs-internal.h\n        5 delta-islands.h\n        2 unicode-width.h\n        2 midx.h\n        2 commit-reach.h\n        1 refs/ref-cache.h\n        1 refs/packed-backend.h\n        1 pack-bitmap.h\n  $ \n  \nBTW, I happen to be on the 'pu' branch.\n\nI think some of the errors are due to missing compiler flags\n(-I, -D, etc); which flags did you pass to the compiler?\n\nWell, it killed 15min. before bed! ;-)\n\nATB,\nRamsay Jones\n\n-- >8 --\nSubject: [PATCH] Makefile: add a hdr-check target\n\nSigned-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n---\n Makefile | 10 ++++++++++\n 1 file changed, 10 insertions(+)\n\ndiff --git a/Makefile b/Makefile\nindex 9923db888c..798396c52e 100644\n--- a/Makefile\n+++ b/Makefile\n@@ -2684,6 +2684,16 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE\n .PHONY: sparse $(SP_OBJ)\n sparse: $(SP_OBJ)\n \n+EXCEPT_HDRS := ./compat% ./xdiff% ./ewah%\n+CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))\n+HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))\n+\n+$(HCO): %.hco: %.h FORCE\n+\t$(CC) -Wall -include git-compat-util.h -I. -o /dev/null -c -xc $<\n+\n+.PHONY: hdr-check $(HCO)\n+hdr-check: $(HCO)\n+\n .PHONY: style\n style:\n \tgit clang-format --style file --diff --extensions c,h\n-- \n2.18.0\n"},{"id":"355849","messageId":"xmqqtvnufflg.fsf@gitster-ct.c.googlers.com","threadId":"49135","inReplyTo":"b8553a50-6b97-2b45-2f7b-cfe2576548cb@ramsayjones.plus.com","subject":"Re: [PATCHv4 0/6] Add missing includes and forward declares","fromName":"Junio C Hamano","fromEmail":"gitster@pobox.com","sentAt":"2018-08-16T16:20:27Z","receivedAt":"2018-08-16T16:20:32Z","isPatch":false,"sender":{"key":"gitster@pobox.com","avatar":"https://avatars.githubusercontent.com/u/54884?v=4"},"body":"Ramsay Jones <ramsay@ramsayjones.plus.com> writes:\n\n> BTW, I happen to be on the 'pu' branch.\n>\n> I think some of the errors are due to missing compiler flags\n> (-I, -D, etc); which flags did you pass to the compiler?\n>\n> Well, it killed 15min. before bed! ;-)\n>\n> ATB,\n> Ramsay Jones\n\nIt certainly does look fun.  I anticipate (read: mostly \"hinting\nthat I won't be the one who would be doing so\") somebody would make\nit a real patch, as the current trend seems to be to automate as\nmuch checking as we reasonably can.\n\n> -- >8 --\n> Subject: [PATCH] Makefile: add a hdr-check target\n>\n> Signed-off-by: Ramsay Jones <ramsay@ramsayjones.plus.com>\n> ---\n>  Makefile | 10 ++++++++++\n>  1 file changed, 10 insertions(+)\n>\n> diff --git a/Makefile b/Makefile\n> index 9923db888c..798396c52e 100644\n> --- a/Makefile\n> +++ b/Makefile\n> @@ -2684,6 +2684,16 @@ $(SP_OBJ): %.sp: %.c GIT-CFLAGS FORCE\n>  .PHONY: sparse $(SP_OBJ)\n>  sparse: $(SP_OBJ)\n>  \n> +EXCEPT_HDRS := ./compat% ./xdiff% ./ewah%\n> +CHK_HDRS = $(filter-out $(EXCEPT_HDRS),$(LIB_H))\n> +HCO = $(patsubst %.h,%.hco,$(CHK_HDRS))\n> +\n> +$(HCO): %.hco: %.h FORCE\n> +\t$(CC) -Wall -include git-compat-util.h -I. -o /dev/null -c -xc $<\n> +\n> +.PHONY: hdr-check $(HCO)\n> +hdr-check: $(HCO)\n> +\n>  .PHONY: style\n>  style:\n>  \tgit clang-format --style file --diff --extensions c,h\n"},{"id":"355860","messageId":"20180816174810.GD882@sigill.intra.peff.net","threadId":"49135","inReplyTo":"b8553a50-6b97-2b45-2f7b-cfe2576548cb@ramsayjones.plus.com","subject":"Re: [PATCHv4 0/6] Add missing includes and forward declares","fromName":"Jeff King","fromEmail":"peff@peff.net","sentAt":"2018-08-16T17:48:11Z","receivedAt":"2018-08-16T17:48:14Z","isPatch":false,"sender":{"key":"peff@peff.net","avatar":"https://avatars.githubusercontent.com/u/45925?v=4"},"body":"On Thu, Aug 16, 2018 at 01:19:17AM +0100, Ramsay Jones wrote:\n\n> As a quick (\"just before bedtime\") exercise, I tried adding\n> a Makefile target to perform a similar check. The result is\n> given below, but I haven't had time to look too closely at\n> the results:\n\nThe resulting patch doesn't look too horrible, and I think it would be\ngreat to automate this, even if people don't always run it by default.\n\nThe flip side is the \"do all files include git-compat-util.h first\" test\nI mentioned elsewhere (and which resulted in the test-tool.h patch).\nThat could be automated, too. I did it like:\n\n  {\n    echo '#undef int'\n    cat git-compat-util.h\n  } >tmp\n  mv tmp git-compat-util.h\n  make CFLAGS=-Dint=foo\n\nThat's obviously pretty nasty, but if we were willing to carry:\n\n  #ifdef UNDO_TRICKY_LINT_HACK\n  #undef int\n  #endif\n\nin git-compat-util.h, it could be driven from the Makefile. Maybe\nworth-while to couple with this.\n\n-Peff\n"}]}