git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Elijah Newren <newren@gmail.com>
To: git@vger.kernel.org
Cc: avarab@gmail.com, peff@peff.net, ramsay@ramsayjones.plus.com,
	jrnieder@gmail.com, Elijah Newren <newren@gmail.com>
Subject: [PATCHv4 0/6] Add missing includes and forward declares
Date: Wed, 15 Aug 2018 10:54:04 -0700	[thread overview]
Message-ID: <20180815175410.5726-1-newren@gmail.com> (raw)
In-Reply-To: <https://public-inbox.org/git/20180813171749.10481-1-newren@gmail.com/>

This series fixes compilation errors when using a simple test.c file that
includes git-compat-util.h and then exactly one other header (and repeating
this for different headers of git).

Changes in this series come from Jonathan Nieder's reviews; full
range-diff follows below, but in summary:

  - Squashed the final patch from the previous series into the first (Junio
    already applied a previous round and resolved the simple conflicts with
    next and pu, so making it easy to drop doesn't save effort anymore.)
  - Added a new patch to the series removing the forward declaration of
    an enum, for portability reasons.
  - Added Jonathan's Reviewed-by on the relevant patches
  - Remove a few includes and forward declares (which were initially added
    in previous rounds of this series) that are no longer necessary (due to
    other includes)
  - Fixed wording in commit message for patch 1 and added some comments
    about methodology used to come up with the patch.

Elijah Newren (6):
  Add missing includes and forward declarations
  alloc: make allocate_alloc_state and clear_alloc_state more consistent
  Move definition of enum branch_track from cache.h to branch.h
  urlmatch.h: fix include guard
  compat/precompose_utf8.h: use more common include guard style
  Remove forward declaration of an enum

 alloc.c                  |  2 +-
 alloc.h                  |  4 +++-
 apply.h                  |  3 +++
 archive.h                |  1 +
 attr.h                   |  1 +
 bisect.h                 |  2 ++
 branch.h                 | 13 +++++++++++++
 bulk-checkin.h           |  2 ++
 cache.h                  | 10 ----------
 column.h                 |  1 +
 commit-graph.h           |  1 +
 compat/precompose_utf8.h |  3 ++-
 config.c                 |  1 +
 config.h                 |  5 +++++
 connected.h              |  1 +
 convert.h                |  2 ++
 csum-file.h              |  2 ++
 diffcore.h               |  4 ++++
 dir-iterator.h           |  2 ++
 environment.c            |  1 +
 fsck.h                   |  1 +
 fsmonitor.h              |  3 +++
 gpg-interface.h          |  2 ++
 khash.h                  |  3 +++
 list-objects-filter.h    |  4 ++++
 list-objects.h           |  4 ++++
 ll-merge.h               |  2 ++
 mailinfo.h               |  2 ++
 mailmap.h                |  2 ++
 merge-recursive.h        |  4 +++-
 notes-merge.h            |  4 ++++
 notes-utils.h            |  3 +++
 notes.h                  |  3 +++
 object-store.h           |  1 +
 object.h                 |  2 ++
 oidmap.h                 |  1 +
 pack-bitmap.h            |  3 +++
 pack-objects.h           |  1 +
 packfile.h               |  2 +-
 patch-ids.h              |  6 ++++++
 path.h                   |  1 +
 pathspec.h               |  2 ++
 pretty.h                 |  4 ++++
 reachable.h              |  2 ++
 reflog-walk.h            |  1 +
 refs.h                   |  2 ++
 remote.h                 |  1 +
 repository.h             |  2 ++
 resolve-undo.h           |  2 ++
 revision.h               |  1 +
 send-pack.h              |  4 ++++
 sequencer.h              |  5 +++++
 shortlog.h               |  2 ++
 submodule.h              | 10 ++++++++--
 tempfile.h               |  1 +
 trailer.h                |  2 ++
 tree-walk.h              |  2 ++
 unpack-trees.h           |  5 ++++-
 url.h                    |  2 ++
 urlmatch.h               |  2 ++
 utf8.h                   |  2 ++
 worktree.h               |  1 +
 62 files changed, 152 insertions(+), 18 deletions(-)

1:  f7d50cef3b ! 1:  e6a93208b2 Add missing includes and forward declares
    @@ -1,6 +1,13 @@
     Author: Elijah Newren <newren@gmail.com>
     
    -    Add missing includes and forward declares
    +    Add missing includes and forward declarations
    +
    +    I looped over the toplevel header files, creating a temporary two-line C
    +    program for each consisting of
    +      #include "git-compat-util.h"
    +      #include $HEADER
    +    This patch is the result of manually fixing errors in compiling those
    +    tiny programs.
     
         Signed-off-by: Elijah Newren <newren@gmail.com>
     
    @@ -38,15 +45,13 @@
     --- a/archive.h
     +++ b/archive.h
     @@
    + #ifndef ARCHIVE_H
    + #define ARCHIVE_H
      
    ++#include "cache.h"
      #include "pathspec.h"
      
    -+struct object_id;
    -+enum object_type;
    -+
      struct archiver_args {
    - 	const char *base;
    - 	size_t baselen;
     
     diff --git a/attr.h b/attr.h
     --- a/attr.h
    @@ -60,6 +65,19 @@
      /*
       * Given a string, return the gitattribute object that
     
    +diff --git a/bisect.h b/bisect.h
    +--- a/bisect.h
    ++++ b/bisect.h
    +@@
    + #ifndef BISECT_H
    + #define BISECT_H
    +
    ++struct commit_list;
    ++
    + /*
    +  * Find bisection. If something is found, `reaches` will be the number of
    +  * commits that the best commit reaches. `all` will be the count of
    +
     diff --git a/branch.h b/branch.h
     --- a/branch.h
     +++ b/branch.h
    @@ -213,10 +231,6 @@
      
     +#include "cache.h"
     +#include "dir.h"
    -+
    -+struct cache_entry;
    -+struct index_state;
    -+struct strbuf;
     +
      extern struct trace_key trace_fsmonitor;
      
    @@ -428,6 +442,18 @@
      	char magic[4];
      	uint16_t version;
     
    +diff --git a/pack-objects.h b/pack-objects.h
    +--- a/pack-objects.h
    ++++ b/pack-objects.h
    +@@
    + #define PACK_OBJECTS_H
    +
    + #include "object-store.h"
    ++#include "pack.h"
    +
    + #define DEFAULT_DELTA_CACHE_SIZE (256 * 1024 * 1024)
    +
    +
     diff --git a/patch-ids.h b/patch-ids.h
     --- a/patch-ids.h
     +++ b/patch-ids.h
    @@ -464,9 +490,6 @@
      #ifndef PATHSPEC_H
      #define PATHSPEC_H
      
    -+#include "string.h"
    -+#include "strings.h"
    -+
     +struct index_state;
     +
      /* Pathspec magic */
2:  e46bf7d601 ! 2:  f199566088 alloc: make allocate_alloc_state and clear_alloc_state more consistent
    @@ -6,6 +6,7 @@
         refer to it as void *, or both use the real type (struct alloc_state *).
         Opt for the latter.
     
    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
         Signed-off-by: Elijah Newren <newren@gmail.com>
     
     diff --git a/alloc.c b/alloc.c
3:  aec8ddda59 ! 3:  169c90a96f Move definition of enum branch_track from cache.h to branch.h
    @@ -7,6 +7,7 @@
         for this small enum, just move the enum and the external declaration
         for git_branch_track to branch.h.
     
    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
         Signed-off-by: Elijah Newren <newren@gmail.com>
     
     diff --git a/branch.h b/branch.h
4:  14e33fb5ff ! 4:  5a36e50d4d urlmatch.h: fix include guard
    @@ -2,6 +2,7 @@
     
         urlmatch.h: fix include guard
     
    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
         Signed-off-by: Elijah Newren <newren@gmail.com>
     
     diff --git a/urlmatch.h b/urlmatch.h
5:  3e02a381af ! 5:  8f247b24a7 compat/precompose_utf8.h: use more common include guard style
    @@ -2,6 +2,7 @@
     
         compat/precompose_utf8.h: use more common include guard style
     
    +    Reviewed-by: Jonathan Nieder <jrnieder@gmail.com>
         Signed-off-by: Elijah Newren <newren@gmail.com>
     
     diff --git a/compat/precompose_utf8.h b/compat/precompose_utf8.h
6:  aca61bade1 < -:  ---------- Add missing includes and forward declares
-:  ---------- > 6:  74975b7909 Remove forward declaration of an enum

-- 
2.18.0.553.g74975b7909

       reply	other threads:[~2018-08-15 17:54 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <https://public-inbox.org/git/20180813171749.10481-1-newren@gmail.com/>
2018-08-15 17:54 ` Elijah Newren [this message]
2018-08-15 17:54   ` [PATCHv4 1/6] Add missing includes and forward declarations Elijah Newren
2018-08-15 20:36     ` Jonathan Nieder
2018-08-15 17:54   ` [PATCHv4 2/6] alloc: make allocate_alloc_state and clear_alloc_state more consistent Elijah Newren
2018-08-15 20:37     ` Jonathan Nieder
2018-08-15 17:54   ` [PATCHv4 3/6] Move definition of enum branch_track from cache.h to branch.h Elijah Newren
2018-08-15 17:54   ` [PATCHv4 4/6] urlmatch.h: fix include guard Elijah Newren
2018-08-15 17:54   ` [PATCHv4 5/6] compat/precompose_utf8.h: use more common include guard style Elijah Newren
2018-08-15 17:54   ` [PATCHv4 6/6] Remove forward declaration of an enum Elijah Newren
2018-08-15 20:40     ` Jonathan Nieder
2018-08-15 20:41   ` [PATCHv4 0/6] Add missing includes and forward declares Jonathan Nieder
2018-08-16  0:19   ` Ramsay Jones
2018-08-16 16:20     ` Junio C Hamano
2018-08-16 17:48     ` Jeff King

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180815175410.5726-1-newren@gmail.com \
    --to=newren@gmail.com \
    --cc=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jrnieder@gmail.com \
    --cc=peff@peff.net \
    --cc=ramsay@ramsayjones.plus.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).