[PATCH] improve hack in src/base/TextException.h

From: Kinkie <gkinkie_at_gmail.com>
Date: Mon, 31 Jan 2011 15:17:49 +0100

TextException.h includes an hack to avoid the compiler noticing that
there are multiple instances of FileNameHashCached() in the compiled
binary.
Intel's icc doesn't like the way it is implemented, and instead of
trying to figure out how to have it stop complaining, I propose to use
a specific-purpose gcc construct, as done in this patch. Thoughts?
Votes?

=== modified file 'src/base/TextException.h'
--- src/base/TextException.h 2010-11-21 04:40:05 +0000
+++ src/base/TextException.h 2011-01-27 11:16:47 +0000
@@ -5,6 +5,9 @@

 #include <exception>

+#if __GNUC__
+__attribute__((unused))
+#endif
 static unsigned int FileNameHashCached(const char *fname);

 // simple exception to report custom errors
@@ -60,11 +63,13 @@
     return lastHash;
 }

+#if 0
 /// Avoids "defined but not used" warnings for FileNameHashCached
 class FileNameHashCacheUser
 {
     bool use(void *ptr=NULL) { return ptr != &FileNameHashCached;}
 };
+#endif

 #if !defined(TexcHere)
 # define TexcHere(msg) TextException((msg), __FILE__, __LINE__, \

-- 
    /kinkie
Received on Mon Jan 31 2011 - 14:18:09 MST

This archive was generated by hypermail 2.2.0 : Mon Jan 31 2011 - 12:00:07 MST