Mesa (master): gallium/hud: use #ifdef to test for macro existence

Eric Engeström eric_engestrom at kemper.freedesktop.org
Fri Dec 1 13:50:20 UTC 2017


Module: Mesa
Branch: master
Commit: 29ee934331ce624ce4c30750ce0e8d4baa5eb2fa
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=29ee934331ce624ce4c30750ce0e8d4baa5eb2fa

Author: Eric Engestrom <eric.engestrom at imgtec.com>
Date:   Wed Nov 29 14:19:26 2017 +0000

gallium/hud: use #ifdef to test for macro existence

Signed-off-by: Eric Engestrom <eric.engestrom at imgtec.com>
Reviewed-by: Nicolai Hähnle <nicolai.haehnle at amd.com>

---

 src/gallium/auxiliary/hud/hud_context.c      | 10 +++++-----
 src/gallium/auxiliary/hud/hud_cpufreq.c      |  2 +-
 src/gallium/auxiliary/hud/hud_diskstat.c     |  2 +-
 src/gallium/auxiliary/hud/hud_nic.c          |  2 +-
 src/gallium/auxiliary/hud/hud_private.h      |  4 ++--
 src/gallium/auxiliary/hud/hud_sensors_temp.c |  2 +-
 6 files changed, 11 insertions(+), 11 deletions(-)

diff --git a/src/gallium/auxiliary/hud/hud_context.c b/src/gallium/auxiliary/hud/hud_context.c
index bd7c8cbb38..64e5579b4e 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -1201,7 +1201,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
       }
 
       /* Add a graph. */
-#if HAVE_GALLIUM_EXTRA_HUD || HAVE_LIBSENSORS
+#if defined(HAVE_GALLIUM_EXTRA_HUD) || defined(HAVE_LIBSENSORS)
       char arg_name[64];
 #endif
       /* IF YOU CHANGE THIS, UPDATE print_help! */
@@ -1229,7 +1229,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
       else if (strcmp(name, "main-thread-busy") == 0) {
          hud_thread_busy_install(pane, name, true);
       }
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
       else if (sscanf(name, "nic-rx-%s", arg_name) == 1) {
          hud_nic_graph_install(pane, arg_name, NIC_DIRECTION_RX);
       }
@@ -1261,7 +1261,7 @@ hud_parse_env_var(struct hud_context *hud, struct pipe_screen *screen,
          pane->type = PIPE_DRIVER_QUERY_TYPE_HZ;
       }
 #endif
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
       else if (sscanf(name, "sensors_temp_cu-%s", arg_name) == 1) {
          hud_sensors_temp_graph_install(pane, arg_name,
                                         SENSORS_TEMP_CURRENT);
@@ -1536,12 +1536,12 @@ print_help(struct pipe_screen *screen)
       puts("    cs-invocations");
    }
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
    hud_get_num_disks(1);
    hud_get_num_nics(1);
    hud_get_num_cpufreq(1);
 #endif
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
    hud_get_num_sensors(1);
 #endif
 
diff --git a/src/gallium/auxiliary/hud/hud_cpufreq.c b/src/gallium/auxiliary/hud/hud_cpufreq.c
index 2b881a850e..f5b7c0f2eb 100644
--- a/src/gallium/auxiliary/hud/hud_cpufreq.c
+++ b/src/gallium/auxiliary/hud/hud_cpufreq.c
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose:
  * Reading /sys/devices/system/cpu/cpu?/cpufreq/scaling_???_freq
diff --git a/src/gallium/auxiliary/hud/hud_diskstat.c b/src/gallium/auxiliary/hud/hud_diskstat.c
index 53b32baef2..44174d655d 100644
--- a/src/gallium/auxiliary/hud/hud_diskstat.c
+++ b/src/gallium/auxiliary/hud/hud_diskstat.c
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose: Reading /sys/block/<*>/stat MB/s read/write throughput per second,
  * displaying on the HUD.
diff --git a/src/gallium/auxiliary/hud/hud_nic.c b/src/gallium/auxiliary/hud/hud_nic.c
index bb29a90dbc..1de5705edf 100644
--- a/src/gallium/auxiliary/hud/hud_nic.c
+++ b/src/gallium/auxiliary/hud/hud_nic.c
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 
 /* Purpose: Reading network interface RX/TX throughput per second,
  * displaying on the HUD.
diff --git a/src/gallium/auxiliary/hud/hud_private.h b/src/gallium/auxiliary/hud/hud_private.h
index 7f0294badd..9e8d74c2f8 100644
--- a/src/gallium/auxiliary/hud/hud_private.h
+++ b/src/gallium/auxiliary/hud/hud_private.h
@@ -178,7 +178,7 @@ void hud_batch_query_update(struct hud_batch_query_context *bq,
 void hud_batch_query_cleanup(struct hud_batch_query_context **pbq,
                              struct pipe_context *pipe);
 
-#if HAVE_GALLIUM_EXTRA_HUD
+#ifdef HAVE_GALLIUM_EXTRA_HUD
 int hud_get_num_nics(bool displayhelp);
 #define NIC_DIRECTION_RX 1
 #define NIC_DIRECTION_TX 2
@@ -199,7 +199,7 @@ int hud_get_num_cpufreq(bool displayhelp);
 void hud_cpufreq_graph_install(struct hud_pane *pane, int cpu_index, unsigned int mode);
 #endif
 
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
 int hud_get_num_sensors(bool displayhelp);
 #define SENSORS_TEMP_CURRENT     1
 #define SENSORS_TEMP_CRITICAL    2
diff --git a/src/gallium/auxiliary/hud/hud_sensors_temp.c b/src/gallium/auxiliary/hud/hud_sensors_temp.c
index 7ae6f71b55..b912a4ea7a 100644
--- a/src/gallium/auxiliary/hud/hud_sensors_temp.c
+++ b/src/gallium/auxiliary/hud/hud_sensors_temp.c
@@ -26,7 +26,7 @@
  *
  **************************************************************************/
 
-#if HAVE_LIBSENSORS
+#ifdef HAVE_LIBSENSORS
 /* Purpose: Extract lm-sensors data, expose temperature, power, voltage. */
 
 #include "hud/hud_private.h"




More information about the mesa-commit mailing list