boost/parameter/keyword.hpp warning, TI compiler

Hello,
When I compile a file, that consists of only one line:
#include

2010/12/2 Krzysztof Czainski <1czajnik@gmail.com>
Hello,
When I compile a file, that consists of only one line:
#include
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

Hi Kris, If this message comes across as a style issue, please feel free to ignore it. In the past, when having to support different platforms, I've had to use things like "#ifdef THIS_PLATFORM". However, I did it slightly different to you. Instead of having multiple #ifdef THIS_PLATFORM within a function, I would wrap the entire function definition withing a single "#ifdef THIS_PLATFORM" HTH, Ian On 2 December 2010 19:25, Krzysztof Czainski <1czajnik@gmail.com> wrote:
2010/12/2 Krzysztof Czainski <1czajnik@gmail.com>
Hello,
When I compile a file, that consists of only one line:
#include
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 mailing list Boost-users@lists.boost.org http://lists.boost.org/mailman/listinfo.cgi/boost-users
-- -- ACCU - Professionalism in programming - http://www.accu.org/

On Thu, 2 Dec 2010 20:25:26 +0100, Krzysztof Czainski wrote:
2010/12/2 Krzysztof Czainski Hello,
When I compile a file, that consists of only one line:
#include
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__ Does this not violate the ODR? The anonymous namespace is different for each TU => void_reference() will be different in each TU.
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?
See above. -- VH

2010/12/3 Václav Haisman
On Thu, 2 Dec 2010 20:25:26 +0100, Krzysztof Czainski wrote:
2010/12/2 Krzysztof Czainski
#ifdef __TI_COMPILER_VERSION__ namespace { void_ void_instance = {}; } #endif // __TI_COMPILER_VERSION__
Does this not violate the ODR? The anonymous namespace is different for each TU => void_reference() will be different in each TU.
inline void_& void_reference() { #ifdef __TI_COMPILER_VERSION__ return void_instance; #else // __TI_COMPILER_VERSION__ static void_ instance; return instance; #endif // __TI_COMPILER_VERSION__ }
-- VH
Thanks for pointing this out. In that case, what do You think of putting the whole void_reference() function into an anonymous namespace? Regards Kris
participants (3)
-
Ian Bruntlett
-
Krzysztof Czainski
-
Václav Haisman