Skip to content

Commit c4d9c79

Browse files
szedergitster
authored andcommitted
treewide: remove unnecessary inclusions of parse-options.h from headers
The headers 'diagnose.h', 'list-objects-filter-options.h', 'ref-filter.h' and 'remote.h' declare option parsing callback functions with a 'struct option*' parameter, and 'revision.h' declares an option parsing helper function taking 'struct parse_opt_ctx_t*' and 'struct option*' parameters. These headers all include 'parse-options.h', although they don't need any of the type definitions from that header file. Furthermore, 'list-objects-filter-options.h' and 'ref-filter.h' also define some OPT_* macros to initialize a 'struct option', but these don't necessitate the inclusion of parse-options.h in these headers either, because these macros are only expanded in source files. Remove these unnecessary inclusions of parse-options.h and use forward declarations to declare the necessary types. After this patch none of the header files include parse-options.h anymore. With these changes, the build time after modifying only parse-options.h is reduced by about 30%, and the number of targets built is almost 20% less: Before: $ touch parse-options.h && time make -j4 |wc -l 353 real 1m1.527s user 3m32.205s sys 0m15.903s After: 289 real 0m39.285s user 2m12.540s sys 0m11.164s Signed-off-by: SZEDER Gábor <[email protected]> Reviewed-by: Elijah Newren <[email protected]> Signed-off-by: Junio C Hamano <[email protected]>
1 parent 49fd551 commit c4d9c79

File tree

5 files changed

+8
-5
lines changed

5 files changed

+8
-5
lines changed

diagnose.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@
22
#define DIAGNOSE_H
33

44
#include "strbuf.h"
5-
#include "parse-options.h"
5+
6+
struct option;
67

78
enum diagnose_mode {
89
DIAGNOSE_NONE,

list-objects-filter-options.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@
22
#define LIST_OBJECTS_FILTER_OPTIONS_H
33

44
#include "cache.h"
5-
#include "parse-options.h"
65
#include "string-list.h"
76

7+
struct option;
8+
89
/*
910
* The list of defined filters for list-objects.
1011
*/

ref-filter.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
#include "oid-array.h"
55
#include "refs.h"
66
#include "commit.h"
7-
#include "parse-options.h"
87

98
/* Quoting styles */
109
#define QUOTE_NONE 0
@@ -24,6 +23,7 @@
2423

2524
struct atom_value;
2625
struct ref_sorting;
26+
struct option;
2727

2828
enum ref_sorting_order {
2929
REF_SORTING_REVERSE = 1<<0,

remote.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
#define REMOTE_H
33

44
#include "cache.h"
5-
#include "parse-options.h"
65
#include "hashmap.h"
76
#include "refspec.h"
87

8+
struct option;
99
struct transport_ls_refs_options;
1010

1111
/**

revision.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
#define REVISION_H
33

44
#include "commit.h"
5-
#include "parse-options.h"
65
#include "grep.h"
76
#include "notes.h"
87
#include "pretty.h"
@@ -61,6 +60,8 @@ struct string_list;
6160
struct saved_parents;
6261
struct bloom_key;
6362
struct bloom_filter_settings;
63+
struct option;
64+
struct parse_opt_ctx_t;
6465
define_shared_commit_slab(revision_sources, char *);
6566

6667
struct rev_cmdline_info {

0 commit comments

Comments
 (0)