So, just for curiosity, I decided to try llvm-clang to build openocd.
I haven't actually run the build yet, but it's just over half the
size of the gcc build, and compiled just a touch faster, too. Any
comments? The time output is from "make -j3" calls.

openocd-via-gcc:
real    0m25.669s
user    0m35.514s
sys     0m3.356s
3308583b        3232k

openocd-via-clang:
real    0m22.014s
user    0m29.186s
sys     0m3.260s
1742244b        1702k

Building with clang did take a few very small changes - The change to
helper/log.h is because clang doesn't like an expression where the
result is unused. In helper/system.h, I just defined true and false
since clang doesn't have them builtin.

>From 9d5082c0c7825a6492714d9363cf9a9d570a20d3 Mon Sep 17 00:00:00 2001
From: Alex Austin <alex.aus...@spectrumdsi.com>
Date: Fri, 29 Jan 2010 00:41:44 -0600
Subject: [PATCH] Clang support

---
 src/helper/log.h    |    2 +-
 src/helper/system.h |    5 +++++
 2 files changed, 6 insertions(+), 1 deletions(-)

diff --git a/src/helper/log.h b/src/helper/log.h
index ebcb8a1..b887e0c 100644
--- a/src/helper/log.h
+++ b/src/helper/log.h
@@ -111,7 +111,7 @@ extern int debug_level;
 #define LOG_LEVEL_IS(FOO)  ((debug_level) >= (FOO))
 
 #define LOG_DEBUG(expr ...) \
-               ((debug_level >= LOG_LVL_DEBUG) ? log_printf_lf (LOG_LVL_DEBUG, 
__FILE__, __LINE__, __FUNCTION__, expr) , 0 : 0)
+               do {if (debug_level >= LOG_LVL_DEBUG) log_printf_lf 
(LOG_LVL_DEBUG, __FILE__, __LINE__, __FUNCTION__, expr);} while (0)
 
 #define LOG_INFO(expr ...) \
                log_printf_lf (LOG_LVL_INFO, __FILE__, __LINE__, __FUNCTION__, 
expr)
diff --git a/src/helper/system.h b/src/helper/system.h
index 169df1c..77a867a 100644
--- a/src/helper/system.h
+++ b/src/helper/system.h
@@ -83,4 +83,9 @@
 #include <fcntl.h>
 #endif
 
+#ifndef true
+#define true -1
+#define false 0
+#endif
+
 #endif // SYSTEM_H
-- 
1.6.6
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to