]> git.ipfire.org Git - thirdparty/git.git/commitdiff
treewide: remove unnecessary inclusions of parse-options.h from headers
authorSZEDER Gábor <szeder.dev@gmail.com>
Sun, 19 Mar 2023 16:27:12 +0000 (17:27 +0100)
committerJunio C Hamano <gitster@pobox.com>
Mon, 20 Mar 2023 18:55:18 +0000 (11:55 -0700)
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 <szeder.dev@gmail.com>
Reviewed-by: Elijah Newren <newren@gmail.com>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
diagnose.h
list-objects-filter-options.h
ref-filter.h
remote.h
revision.h

index 7a4951a7863bcea8ac37e2d40d656b794f9bc925..f525219ab0cf9b36249892c847e731b952b081af 100644 (file)
@@ -2,7 +2,8 @@
 #define DIAGNOSE_H
 
 #include "strbuf.h"
-#include "parse-options.h"
+
+struct option;
 
 enum diagnose_mode {
        DIAGNOSE_NONE,
index 1fe393f447303a6d94abbd571a1ea83a1bfc7620..aad295f2327996b82f4b568d42cb88a3aa278cba 100644 (file)
@@ -2,9 +2,10 @@
 #define LIST_OBJECTS_FILTER_OPTIONS_H
 
 #include "cache.h"
-#include "parse-options.h"
 #include "string-list.h"
 
+struct option;
+
 /*
  * The list of defined filters for list-objects.
  */
index aa0eea4ecf591edd0620dc47db0e0bfc3e5c4208..daa6d02017489d5b6454790503afaa0b6079a08e 100644 (file)
@@ -4,7 +4,6 @@
 #include "oid-array.h"
 #include "refs.h"
 #include "commit.h"
-#include "parse-options.h"
 
 /* Quoting styles */
 #define QUOTE_NONE 0
@@ -24,6 +23,7 @@
 
 struct atom_value;
 struct ref_sorting;
+struct option;
 
 enum ref_sorting_order {
        REF_SORTING_REVERSE = 1<<0,
index 1ebbe42792ec67230b62dbbe4cb8ed9646576858..92eccf22ec985183522119fb5602a95103c9c480 100644 (file)
--- a/remote.h
+++ b/remote.h
@@ -2,10 +2,10 @@
 #define REMOTE_H
 
 #include "cache.h"
-#include "parse-options.h"
 #include "hashmap.h"
 #include "refspec.h"
 
+struct option;
 struct transport_ls_refs_options;
 
 /**
index 30febad09a1e3493ed9b89cd57486134cc120f14..d5b26db955b7fc32481ff9cf86c2ce224e5a07b3 100644 (file)
@@ -2,7 +2,6 @@
 #define REVISION_H
 
 #include "commit.h"
-#include "parse-options.h"
 #include "grep.h"
 #include "notes.h"
 #include "pretty.h"
@@ -61,6 +60,8 @@ struct string_list;
 struct saved_parents;
 struct bloom_key;
 struct bloom_filter_settings;
+struct option;
+struct parse_opt_ctx_t;
 define_shared_commit_slab(revision_sources, char *);
 
 struct rev_cmdline_info {