[PATCH 1/4] environ-selftests: Ignore -Wself-move warning

Pedro Alves palves@redhat.com
Wed Jun 21 21:28:00 GMT 2017


On 06/21/2017 10:05 PM, Simon Marchi wrote:

> Yeah, I didn't expect to have to put the #ifdefs for __clang__ though. 
> Without them, gcc emits a warning [-Wunknown-pragma].  We always have
> the option to turn -Wunknown-pragma off globally, what do you prefer?
> 

Don't both GCC and Clang understand "#pragma GCC diagnostic" instead?

Or better even, wrap it in some macros (and use _Pragma):

 #define DIAGNOSTIC_PUSH _Pragma ("GCC diagnostic push")
 #define DIAGNOSTIC_POP _Pragma ("GCC diagnostic pop")
 #define DIAGNOSTIC_IGNORE(option) \
   _Pragma (STRINGIFY (GCC diagnostic ignored option))

Alternatively, you could replace the std::move with a cast
to rvalue ref, which is just what std::move really is:

 -env = std::move (env);
 +env = static_cast<gdb_environ &&> (env);

Thanks,
Pedro Alves



More information about the Gdb-patches mailing list