summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJulian Andres Klode <julian.klode@canonical.com>2020-01-07 22:39:29 +0100
committerJulian Andres Klode <julian.klode@canonical.com>2020-01-07 22:51:41 +0100
commitb911b2f6edaa8ee45b1f860ddf0cf061ccc96e1f (patch)
tree04aef1499999672f8e53ee1b7b56023844d519b6
parent3732fa6e73c8c0c80e8d2b03c002ad66f4e75183 (diff)
Only define likely/unlikely if APT_COMPILING_APT set
This ensures that we do not leak simple words like that.
-rw-r--r--CMake/config.h.in3
-rw-r--r--apt-pkg/contrib/macros.h2
2 files changed, 5 insertions, 0 deletions
diff --git a/CMake/config.h.in b/CMake/config.h.in
index b89f7297d..911d42464 100644
--- a/CMake/config.h.in
+++ b/CMake/config.h.in
@@ -64,6 +64,9 @@
/* The mail address to reach upstream */
#define PACKAGE_MAIL "${PACKAGE_MAIL}"
+/* Guard for code that should only be emitted when compiling apt */
+#define APT_COMPILING_APT
+
/* Various directories */
#cmakedefine CMAKE_INSTALL_FULL_BINDIR "${CMAKE_INSTALL_FULL_BINDIR}"
#cmakedefine STATE_DIR "${STATE_DIR}"
diff --git a/apt-pkg/contrib/macros.h b/apt-pkg/contrib/macros.h
index 3f2638070..340549fbd 100644
--- a/apt-pkg/contrib/macros.h
+++ b/apt-pkg/contrib/macros.h
@@ -29,6 +29,7 @@
#define APT_GCC_VERSION 0
#endif
+#ifdef APT_COMPILING_APT
/* likely() and unlikely() can be used to mark boolean expressions
as (not) likely true which will help the compiler to optimise */
#if APT_GCC_VERSION >= 0x0300
@@ -38,6 +39,7 @@
#define likely(x) (x)
#define unlikely(x) (x)
#endif
+#endif
#if APT_GCC_VERSION >= 0x0300
#define APT_DEPRECATED __attribute__ ((deprecated))