This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

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


On Wednesday, June 21 2017, Pedro Alves wrote:

> 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);

I don't like this cast TBH.  std::move is more readable.

-- 
Sergio
GPG key ID: 237A 54B1 0287 28BF 00EF  31F4 D0EB 7628 65FC 5E36
Please send encrypted e-mail if possible
http://sergiodj.net/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]