Boost logo

Boost Users :

Subject: Re: [Boost-users] boost/parameter/keyword.hpp warning, TI compiler
From: Krzysztof Czainski (1czajnik_at_[hidden])
Date: 2010-12-02 14:25:26


2010/12/2 Krzysztof Czainski <1czajnik_at_[hidden]>

> Hello,
>
> When I compile a file, that consists of only one line:
>
> #include <boost/parameter/keyword.hpp>
>
> with a Texas Intstruments compiler for DSP (cgtools-6.1.12); boost-1.45.0,
> I get this warning:
>
> boost/parameter/aux_/void.hpp, line 20: warning #1369-D: static local
> variables of extern inline function are not resolved to single copy. Not
> ANSI C++ Compliant
>
> It referes to:
> inline void_& void_reference()
> {
> static void_ instance;
> return instance;
> }
>
> In this particular context this warning seams harmless, so I would like to
> suppress it. As far as I know, this compiler doesn't have a #pragma
> warning(disable:1369) equivalent...
>
> I know how suppress this kind of warning globally, but I would not like
> that, because in other contexts this is an important warning.
>
> Any ideas, how I could suppress this warning locally, in code perhaps?
>
> Cheers
> Kris
>

A fix I came up with is modifying void.hpp like this:

#ifdef __TI_COMPILER_VERSION__
  namespace { void_ void_instance = {}; }
#endif // __TI_COMPILER_VERSION__

  inline void_& void_reference()
  {
#ifdef __TI_COMPILER_VERSION__
      return void_instance;
#else // __TI_COMPILER_VERSION__
      static void_ instance;
      return instance;
#endif // __TI_COMPILER_VERSION__
  }

Does anyone see any downsides?

Regards,
Kris



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net