[PATCH 10/12] cache.h & test-tool.h: add & use "USE_THE_INDEX_VARIABLE"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



In a preceding commit we fully applied the
"index-compatibility.pending.cocci" rule to "t/helper/*". Let's now
stop defining "USE_THE_INDEX_COMPATIBILITY_MACROS" in test-tool.h
itself, and instead instead move the define to the individual test
helpers that need it. This mirrors how we do the same thing in the
"builtin/" directory.

We could start using "USE_THE_INDEX_COMPATIBILITY_MACROS", but let's
instead introduce a narrow version of it named
"USE_THE_INDEX_VARIABLE". As the name suggests this doesn't give us
any of the compatibility macros, but only "the_index" variable.

Eventually we'll move other outstanding users of
"USE_THE_INDEX_COMPATIBILITY_MACROS" over to using this more narrow
and descriptive define.

For context: The USE_THE_INDEX_COMPATIBILITY_MACROS macro was added to
test-tool.h in f8adbec9fea (cache.h: flip
NO_THE_INDEX_COMPATIBILITY_MACROS switch, 2019-01-24).

Signed-off-by: Ævar Arnfjörð Bjarmason <avarab@xxxxxxxxx>
---
 t/helper/test-dump-cache-tree.c      | 1 +
 t/helper/test-dump-split-index.c     | 1 +
 t/helper/test-dump-untracked-cache.c | 2 +-
 t/helper/test-fast-rebase.c          | 2 +-
 t/helper/test-lazy-init-name-hash.c  | 1 +
 t/helper/test-read-cache.c           | 1 +
 t/helper/test-scrap-cache-tree.c     | 1 +
 t/helper/test-write-cache.c          | 1 +
 8 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/t/helper/test-dump-cache-tree.c b/t/helper/test-dump-cache-tree.c
index 4bf8bc3df6e..454f17b1a0c 100644
--- a/t/helper/test-dump-cache-tree.c
+++ b/t/helper/test-dump-cache-tree.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "tree.h"
diff --git a/t/helper/test-dump-split-index.c b/t/helper/test-dump-split-index.c
index a209880eb37..0ea97b84072 100644
--- a/t/helper/test-dump-split-index.c
+++ b/t/helper/test-dump-split-index.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "split-index.h"
diff --git a/t/helper/test-dump-untracked-cache.c b/t/helper/test-dump-untracked-cache.c
index ffe34736e53..6d53683f13b 100644
--- a/t/helper/test-dump-untracked-cache.c
+++ b/t/helper/test-dump-untracked-cache.c
@@ -1,4 +1,4 @@
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "dir.h"
diff --git a/t/helper/test-fast-rebase.c b/t/helper/test-fast-rebase.c
index 9def2ba6889..efc82dd80c5 100644
--- a/t/helper/test-fast-rebase.c
+++ b/t/helper/test-fast-rebase.c
@@ -10,7 +10,7 @@
  * refactoring is the better route).
  */
 
-#define USE_THE_INDEX_COMPATIBILITY_MACROS
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 
 #include "cache-tree.h"
diff --git a/t/helper/test-lazy-init-name-hash.c b/t/helper/test-lazy-init-name-hash.c
index 7e8723a1900..ab86c14c8ba 100644
--- a/t/helper/test-lazy-init-name-hash.c
+++ b/t/helper/test-lazy-init-name-hash.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "parse-options.h"
diff --git a/t/helper/test-read-cache.c b/t/helper/test-read-cache.c
index a089be9104c..23e9e27109f 100644
--- a/t/helper/test-read-cache.c
+++ b/t/helper/test-read-cache.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "config.h"
diff --git a/t/helper/test-scrap-cache-tree.c b/t/helper/test-scrap-cache-tree.c
index 9206dee1fd2..a26107ed70a 100644
--- a/t/helper/test-scrap-cache-tree.c
+++ b/t/helper/test-scrap-cache-tree.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
diff --git a/t/helper/test-write-cache.c b/t/helper/test-write-cache.c
index 66287d6d47d..7d45cd61e82 100644
--- a/t/helper/test-write-cache.c
+++ b/t/helper/test-write-cache.c
@@ -1,3 +1,4 @@
+#define USE_THE_INDEX_VARIABLE
 #include "test-tool.h"
 #include "cache.h"
 #include "lockfile.h"
-- 
2.38.0.1511.gcdcff1f1dc2




[Index of Archives]     [Linux Kernel Development]     [Gcc Help]     [IETF Annouce]     [DCCP]     [Netdev]     [Networking]     [Security]     [V4L]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux SCSI]     [Fedora Users]

  Powered by Linux