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

From: Kinkie <gkinkie_at_gmail.com>
Date: Wed, 16 Feb 2011 17:14:31 +0100

16 days, no comments. May I commit?

   Kinkie

On Mon, Jan 31, 2011 at 3:17 PM, Kinkie <gkinkie_at_gmail.com> 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?
>
> === 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
>

-- 
    /kinkie
Received on Wed Feb 16 2011 - 16:14:40 MST

This archive was generated by hypermail 2.2.0 : Tue Feb 22 2011 - 12:00:05 MST