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

From: Alex Rousskov <rousskov_at_measurement-factory.com>
Date: Fri, 18 Feb 2011 15:25:19 -0700

On 01/31/2011 07:17 AM, Kinkie wrote:
> 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?

What does icc complain about? Kind of hard to agree to add more crap
without seeing what the real problem that needs fixing is...

Alex.

> === 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__, \
>
>
>
Received on Fri Feb 18 2011 - 22:25:30 MST

This archive was generated by hypermail 2.2.0 : Sat Feb 19 2011 - 12:00:05 MST