]> xenbits.xensource.com Git - xen.git/commitdiff
coverage: simplify the logic of choosing the number of gcov counters depending on...
authorJavi Merino <javi.merino@cloud.com>
Mon, 11 Sep 2023 15:26:05 +0000 (17:26 +0200)
committerJan Beulich <jbeulich@suse.com>
Mon, 11 Sep 2023 15:26:05 +0000 (17:26 +0200)
The current structure of choosing the correct file based on the
compiler version makes us make 33 line files just to define a
constant.  The changes after gcc 4.7 are minimal, just the number of
counters.

Fold the changes in gcc_4_9.c, gcc_5.c and gcc_7.c into gcc_4_7.c to
remove a lot of the boilerplate and keep the logic of choosing the
GCOV_COUNTER in gcc_4_7.c.

Signed-off-by: Javi Merino <javi.merino@cloud.com>
Reviewed-by: Jan Beulich <jbeulich@suse.com>
xen/common/coverage/Makefile
xen/common/coverage/gcc_4_7.c
xen/common/coverage/gcc_4_9.c [deleted file]
xen/common/coverage/gcc_5.c [deleted file]
xen/common/coverage/gcc_7.c [deleted file]

index 63f98c71d6b54bd99cd7ecd6b616c5acfa3d4872..d729afc9c7a0c148abe93e7646f4ead5542e0181 100644 (file)
@@ -1,11 +1,7 @@
 obj-y += coverage.o
 ifneq ($(CONFIG_CC_IS_CLANG),y)
 obj-y += gcov_base.o gcov.o
-obj-y += $(call cc-ifversion,-lt,0407, \
-               gcc_3_4.o, $(call cc-ifversion,-lt,0409, \
-               gcc_4_7.o, $(call cc-ifversion,-lt,0500, \
-               gcc_4_9.o, $(call cc-ifversion,-lt,0700, \
-               gcc_5.o, gcc_7.o))))
+obj-y += $(call cc-ifversion,-lt,0407, gcc_3_4.o, gcc_4_7.o)
 else
 obj-y += llvm.o
 endif
index 25b4a8bcdc9ef541663366f8636888ab131ff9a3..449ae8e34f65c4e3171f08aea0d41463890a9b7a 100644 (file)
 
 #include "gcov.h"
 
-/*
- * GCOV_COUNTERS will be defined if this file is included by other
- * source files.
- */
-#ifndef GCOV_COUNTERS
-# if !(GCC_VERSION >= 40700 && GCC_VERSION < 40900)
-#  error "Wrong version of GCC used to compile gcov"
-# endif
+#if GCC_VERSION < 40700
+#error "Wrong version of GCC used to compile gcov"
+#elif GCC_VERSION < 40900
 #define GCOV_COUNTERS 8
+#elif GCC_VERSION < 50000
+#define GCOV_COUNTERS 9
+#elif GCC_VERSION < 70000
+#define GCOV_COUNTERS 10
+#else
+#define GCOV_COUNTERS 9
 #endif
 
 #define GCOV_TAG_FUNCTION_LENGTH        3
diff --git a/xen/common/coverage/gcc_4_9.c b/xen/common/coverage/gcc_4_9.c
deleted file mode 100644 (file)
index dcea961..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 4.7.
- *
- *  For a better understanding, refer to gcc source:
- *  gcc/gcov-io.h
- *  libgcc/libgcov.c
- *
- *  Uses gcc-internal data definitions.
- *
- *  Imported from Linux and modified for Xen by
- *    Wei Liu <wei.liu2@citrix.com>
- */
-
-#include "gcov.h"
-
-#if !(GCC_VERSION >= 40900 && GCC_VERSION < 50000)
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 9
-
-#include "gcc_4_7.c"
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/common/coverage/gcc_5.c b/xen/common/coverage/gcc_5.c
deleted file mode 100644 (file)
index 6e0d276..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 5.
- *
- *  For a better understanding, refer to gcc source:
- *  gcc/gcov-io.h
- *  libgcc/libgcov.c
- *
- *  Uses gcc-internal data definitions.
- *
- *  Imported from Linux and modified for Xen by
- *    Wei Liu <wei.liu2@citrix.com>
- */
-
-#include "gcov.h"
-
-#if GCC_VERSION < 50000 || GCC_VERSION >= 70000
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 10
-
-#include "gcc_4_7.c"
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */
diff --git a/xen/common/coverage/gcc_7.c b/xen/common/coverage/gcc_7.c
deleted file mode 100644 (file)
index 3962eb4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- *  This code provides functions to handle gcc's profiling data format
- *  introduced with gcc 7.
- *
- *  For a better understanding, refer to gcc source:
- *  gcc/gcov-io.h
- *  libgcc/libgcov.c
- *
- *  Uses gcc-internal data definitions.
- */
-
-#include "gcov.h"
-
-#if GCC_VERSION < 70000
-#error "Wrong version of GCC used to compile gcov"
-#endif
-
-#define GCOV_COUNTERS 9
-
-#include "gcc_4_7.c"
-
-/*
- * Local variables:
- * mode: C
- * c-file-style: "BSD"
- * c-basic-offset: 4
- * tab-width: 4
- * indent-tabs-mode: nil
- * End:
- */