treewide: remove unnecessary git-compat-util.h includes in headers
For sanity, we should probably do one of the following: (a) make C and header files both depend upon everything they need (b) consistently exclude git-compat-util.h from headers and require it be the first include in C files Currently, we have some of the headers following (a) and others following (b), which makes things messy. In the past I was pushed towards (b), as per [1] and [2]. Further, during this series I discovered that this mixture empirically will mean that we end up with C files that do not directly include git-compat-util.h, and do include headers that don't include git-compat-util.h, with the result that we likely have headers included before an indirect inclusion of git-compat-util.h. Since git-compat-util.h has tricky platform-specific stuff that is meant to be included before everything else, this state of affairs is risky and may lead to things breaking in subtle ways (and only on some platforms) as per [1] and [2]. Since including git-compat-util.h in existing header files makes it harder for us to catch C files that are missing that include, let's switch to (b) to make the enforcement of this rule easier. Remove the inclusion of git-compat-util.h from header files other than the ones that have been approved as alternate first includes. [1] https://lore.kernel.org/git/20180811173406.GA9119@sigill.intra.peff.net/ [2] https://lore.kernel.org/git/20180811174301.GA9287@sigill.intra.peff.net/ Signed-off-by: Elijah Newren <newren@gmail.com> Signed-off-by: Junio C Hamano <gitster@pobox.com>
This commit is contained in:
parent
8bff5ca030
commit
f332121e75
2
advice.h
2
advice.h
@ -1,8 +1,6 @@
|
||||
#ifndef ADVICE_H
|
||||
#define ADVICE_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
|
||||
struct string_list;
|
||||
|
||||
/*
|
||||
|
2
cbtree.h
2
cbtree.h
@ -14,8 +14,6 @@
|
||||
#ifndef CBTREE_H
|
||||
#define CBTREE_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
|
||||
struct cb_node;
|
||||
struct cb_node {
|
||||
struct cb_node *child[2];
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef CHUNK_FORMAT_H
|
||||
#define CHUNK_FORMAT_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "hash.h"
|
||||
|
||||
struct hashfile;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef COMMIT_GRAPH_H
|
||||
#define COMMIT_GRAPH_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "object-store.h"
|
||||
#include "oidset.h"
|
||||
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef COMMIT_SLAB_IMPL_H
|
||||
#define COMMIT_SLAB_IMPL_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
|
||||
#define implement_static_commit_slab(slabname, elemtype) \
|
||||
implement_commit_slab(slabname, elemtype, MAYBE_UNUSED static)
|
||||
|
||||
|
1
hash.h
1
hash.h
@ -1,7 +1,6 @@
|
||||
#ifndef HASH_H
|
||||
#define HASH_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "repository.h"
|
||||
|
||||
#if defined(SHA1_APPLE)
|
||||
|
@ -1,8 +1,6 @@
|
||||
#ifndef PACK_MTIMES_H
|
||||
#define PACK_MTIMES_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
|
||||
#define MTIMES_SIGNATURE 0x4d544d45 /* "MTME" */
|
||||
#define MTIMES_VERSION 1
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef PKTLINE_H
|
||||
#define PKTLINE_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "strbuf.h"
|
||||
#include "sideband.h"
|
||||
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef REPOSITORY_H
|
||||
#define REPOSITORY_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "path.h"
|
||||
|
||||
struct config_set;
|
||||
|
@ -1,7 +1,6 @@
|
||||
#ifndef SUBPROCESS_H
|
||||
#define SUBPROCESS_H
|
||||
|
||||
#include "git-compat-util.h"
|
||||
#include "hashmap.h"
|
||||
#include "run-command.h"
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user