Message ID | 1498076108-29914-2-git-send-email-simon.marchi@ericsson.com |
---|---|
State | New, archived |
Headers |
Received: (qmail 95623 invoked by alias); 21 Jun 2017 20:15:50 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: <gdb-patches.sourceware.org> List-Unsubscribe: <mailto:gdb-patches-unsubscribe-##L=##H@sourceware.org> List-Subscribe: <mailto:gdb-patches-subscribe@sourceware.org> List-Archive: <http://sourceware.org/ml/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-help@sourceware.org>, <http://sourceware.org/ml/#faqs> Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 95012 invoked by uid 89); 21 Jun 2017 20:15:33 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-26.7 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.2 spammy=globally X-HELO: sesbmg23.ericsson.net Received: from sesbmg23.ericsson.net (HELO sesbmg23.ericsson.net) (193.180.251.37) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 21 Jun 2017 20:15:23 +0000 Received: from ESESSHC001.ericsson.se (Unknown_Domain [153.88.183.21]) by sesbmg23.ericsson.net (Symantec Mail Security) with SMTP id 94.E0.18097.8D3DA495; Wed, 21 Jun 2017 22:15:20 +0200 (CEST) Received: from EUR01-DB5-obe.outbound.protection.outlook.com (153.88.183.145) by oa.msg.ericsson.com (153.88.183.21) with Microsoft SMTP Server (TLS) id 14.3.339.0; Wed, 21 Jun 2017 22:15:19 +0200 Authentication-Results: sourceware.org; dkim=none (message not signed) header.d=none; sourceware.org; dmarc=none action=none header.from=ericsson.com; Received: from elxacz23q12.localdomain (80.216.243.234) by DBXPR07MB320.eurprd07.prod.outlook.com (2a01:111:e400:941d::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.1199.6; Wed, 21 Jun 2017 20:15:18 +0000 From: Simon Marchi <simon.marchi@ericsson.com> To: <gdb-patches@sourceware.org> CC: Simon Marchi <simon.marchi@ericsson.com> Subject: [PATCH 1/4] environ-selftests: Ignore -Wself-move warning Date: Wed, 21 Jun 2017 22:15:05 +0200 Message-ID: <1498076108-29914-2-git-send-email-simon.marchi@ericsson.com> In-Reply-To: <1498076108-29914-1-git-send-email-simon.marchi@ericsson.com> References: <1498076108-29914-1-git-send-email-simon.marchi@ericsson.com> MIME-Version: 1.0 Content-Type: text/plain X-ClientProxiedBy: HE1PR0802CA0016.eurprd08.prod.outlook.com (2603:10a6:3:bd::26) To DBXPR07MB320.eurprd07.prod.outlook.com (2a01:111:e400:941d::21) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 308d218d-305b-457c-8b82-08d4b8e23cd1 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(201703131423075)(201703031133081); SRVR:DBXPR07MB320; X-Microsoft-Exchange-Diagnostics: 1; DBXPR07MB320; 3:Xq8D4nYrLo3BaVd68ULclS0dDuMixZI7mLGpFQFJ6FuRF3UXdeG44Zvwyd7OniLBi52cBu1Yq8bukcmc9jINQyAW6of8l4F6idlW2rWpVGBkt6HETcY50pUFcqZk3I5Teaf169Fb0mkM5h9OCJ0xzzF8PjOqMFOjPXcZYnDVlfA3j7HOASjRypSHwZ1Fwo4uKn/2ZfyK1c2LIVDsB+cb2JOLMp7I1wq/YCJx9XhgB6guj/dlJnwkfdvY6tmSmTOG0+FCpLQId7J0Yfy6zImKxTEeZyrE7wQl9mDkGTxU7LO4nQsaiPmfQV+T+/1wZ684kNuTMWFgq+EXCNN+1Ak2Aw==; 25:JBGK0wF6sL28jQylnxqItQrU4hLiO+VhZQ6e1eky5BRijOADtzRp/wVCDeuF6WZ5uZIzBPqq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VAngBmhnRBEmjJDMNWvbrVYMLivqLysniHdTUFaGI/xeJM60sZU909KtD4lX9Vwa+SR2nF+loKBERtQF6C2y/EJrdsImqa50lX1ywLOdt4QmXVooNY+FHp1vqW1nJdKMt+nfO7ljMCFiC6dWN4Jya3wHm X-Microsoft-Antispam-PRVS: <DBXPR07MB320E1746064310FD15ED92CEDDA0@DBXPR07MB320.eurprd07.prod.outlook.com> X-Exchange-Antispam-Report-Test: UriScan:(22074186197030)(183786458502308); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(100000700101)(100105000095)(100000701101)(100105300095)(100000702101)(100105100095)(6040450)(601004)(2401047)(8121501046)(5005006)(10201501046)(100000703101)(100105400095)(93006095)(93001095)(3002001)(6041248)(20161123564025)(20161123558100)(20161123562025)(201703131423075)(201702281528075)(201703061421075)(201703061406153)(20161123555025)(20161123560025)(6072148)(100000704101)(100105200095)(100000705101)(100105500095); SRVR:DBXPR07MB320; BCL:0; PCL:0; RULEID:(100000800101)(100110000095)(100000801101)(100110300095)(100000802101)(100110100095)(100000803101)(100110400095)(100000804101)(100110200095)(100000805101)(100110500095); SRVR:DBXPR07MB320; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DBXPR07MB320; 4:YiUJbmeQm07Rmi0Gq9Xw5VQgSUQ0bdRwFLL9NbkO4RH?= =?us-ascii?Q?AKWp7GdU4DT/pzcIycJxGW9RIqnVkt9OMX7oYN5eayAbZUo38Y4kQ8n//FKe?= =?us-ascii?Q?Irj8CP1YUq2UnUYu8PA8TNjB4tgazODfO80k050VNuABiRIN6cyYzYC3vTxg?= =?us-ascii?Q?DJmWB8gx4OQ/zT/BaePGpGnKfjLUA3JNPboa0yyQUPLQU8OmPDIvkfqkC9/y?= =?us-ascii?Q?SEkVvqW5ZcahYKBPdxtOYiaFSMT0SFVlrRONh1hq0a1ts4/vulhiMI7OVccc?= =?us-ascii?Q?h+5QOtNRFzEbcG823UTcP1rQky3NXWnYK150YaD75+9ZQ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P2O65csPxYiQNQtLt5+NqlCq7pg=3D?= =?us-ascii?Q?=3D?= X-Forefront-PRVS: 0345CFD558 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(4630300001)(6009001)(39860400002)(39450400003)(39410400002)(39400400002)(39850400002)(305945005)(86362001)(5660300001)(6666003)(25786009)(3846002)(6506006)(478600001)(6916009)(2950100002)(966005)(36756003)(8676002)(81166006)(189998001)(42186005)(6486002)(38730400002)(110136004)(107886003)(50986999)(48376002)(76176999)(66066001)(2351001)(2906002)(7736002)(47776003)(50466002)(4326008)(6512007)(5003940100001)(2361001)(6306002)(33646002)(50226002)(6116002)(53936002); DIR:OUT; SFP:1101; SCL:1; SRVR:DBXPR07MB320; H:elxacz23q12.localdomain; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DBXPR07MB320; 23:9HqetM/oRkTtt7TX5Bq/UpHDmZUQacLup+Cf/v+Lz3?= =?us-ascii?Q?Po+Y18uh41z55En247M5mjzwMugHhnH7P5oHWp4LuslefAucsVh6R1DX5TCb?= =?us-ascii?Q?6QhbBoHksCjcaWIt0LM26fyE7BGx9WePTqch2yirlvKJSst63sstULfoLfDJ?= =?us-ascii?Q?nyjbNbuICs2vcVwc5FsvaQSLLygRXcHfq87ewG1wi/swt2awx4t4RIfZKA0j?= =?us-ascii?Q?qsFV0r7qhxkrdhHxVmj3uEl0L4NoLAcvjM1MWTy07tbpYRbe5jJylS6agEQA?= =?us-ascii?Q?iFC5bpIf9HtVQGVXsNuftBH4ivzT1VvWfZh+wSsg6OKSVn9lWGO73+Ccb4I6?= =?us-ascii?Q?Ma2N+TRIKAkgC0nd3PYndsc+GrGKGwIvhnmIjMlqhtCMIR+HqAL9XFbD3bRg?= =?us-ascii?Q?2eU/6nTbgGStocCV2TaB0C83P3tmXZzuxe4AS17yIXYX0cEwu4NTWsaECMFq?= =?us-ascii?Q?SUxGCXGSXh7dhZmTnYFWp1Tu/YEHzdg+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0oB6IoxY3GHfgrkvDroElwB9oUCHSvI07+cga46qjObnmvnZtqNHv+tU5qzj7e3y/IEQ08CgJ0IfiTRBEJ+GWJD13J1/Ul5fJbws2ZM2lUT5vaFRWkIbRKZi5+UDFU1sx6fLUMKVlKB0+dT+C7znZeOT8lNuVJxu9EbrSgqrIfE+Exm30tBCFsO4SYbNStMnIV1h98Q3Ca2Cu2YRQoo4h3jIB1IZQMtUrt86zQmAD3L6plyThMdaO3Tfp12musLT8/rmPiFIbb9JJzx1rB/Q9DE7JRrRokDsk91ydKScycX+dwJPcSA99DcNgocGY42z5P/AJzfXHl0UjITFNTODOHIDU4lqgWea08k3hGeYwrDFT4hWE+SZZ1DDw0HN7AkBr22rVLH4bXj8akYIatLDWSALNn3w= X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Jun 2017 20:15:18.5755 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: DBXPR07MB320 X-OriginatorOrg: ericsson.com X-IsSubscribed: yes |
Commit Message
Simon Marchi
June 21, 2017, 8:15 p.m. UTC
clang gives this warning: /home/emaisin/src/binutils-gdb/gdb/unittests/environ-selftests.c:139:7: error: explicitly moving variable of type 'gdb_environ' to itself [-Werror,-Wself-move] env = std::move (env); ~~~ ^ ~~~ In this case, ignoring the warning locally is clearly the thing to do, since it warns exactly about the behavior we want to test. We also don't want to disable this globally, because we would want the compiler if we wrote that in real code. I filed a bug in GCC's bugzilla to suggest to add this warning: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159 gdb/ChangeLog: * unittests/environ-selftests.c (run_tests): Ignore -Wself-move warning. --- gdb/unittests/environ-selftests.c | 9 +++++++++ 1 file changed, 9 insertions(+)
Comments
On Wednesday, June 21 2017, Simon Marchi wrote: > clang gives this warning: > > /home/emaisin/src/binutils-gdb/gdb/unittests/environ-selftests.c:139:7: error: explicitly moving variable of type 'gdb_environ' to itself [-Werror,-Wself-move] > env = std::move (env); > ~~~ ^ ~~~ > > In this case, ignoring the warning locally is clearly the thing to do, > since it warns exactly about the behavior we want to test. We also > don't want to disable this globally, because we would want the compiler "we would want the code compiler to warn" > if we wrote that in real code. > > I filed a bug in GCC's bugzilla to suggest to add this warning: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159 Thanks! > gdb/ChangeLog: > > * unittests/environ-selftests.c (run_tests): Ignore -Wself-move > warning. > --- > gdb/unittests/environ-selftests.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c > index ecc3955..6989c5e 100644 > --- a/gdb/unittests/environ-selftests.c > +++ b/gdb/unittests/environ-selftests.c > @@ -136,7 +136,16 @@ run_tests () > env.clear (); > env.set ("A", "1"); > SELF_CHECK (strcmp (env.get ("A"), "1") == 0); > + > +#ifdef __clang__ > +#pragma clang diagnostic push > +#pragma clang diagnostic ignored "-Wself-move" > +#endif /* __clang__ */ > env = std::move (env); > +#ifdef __clang__ > +#pragma clang diagnostic pop > +#endif /* __clang__ */ Wow. I know we've discussed this before, but this is ugly :-/. Anyway, this file is just a unittest, so I'm totally fine with this. Do you think it's worth putting a comment on top, just to explicitly say what this is doing? Otherwise, LGTM. > + > SELF_CHECK (strcmp (env.get ("A"), "1") == 0); > SELF_CHECK (strcmp (env.envp ()[0], "A=1") == 0); > SELF_CHECK (env.envp ()[1] == NULL); > -- > 2.7.4 Thanks,
On 2017-06-21 22:29, Sergio Durigan Junior wrote: > On Wednesday, June 21 2017, Simon Marchi wrote: > >> clang gives this warning: >> >> /home/emaisin/src/binutils-gdb/gdb/unittests/environ-selftests.c:139:7: >> error: explicitly moving variable of type 'gdb_environ' to itself >> [-Werror,-Wself-move] >> env = std::move (env); >> ~~~ ^ ~~~ >> >> In this case, ignoring the warning locally is clearly the thing to do, >> since it warns exactly about the behavior we want to test. We also >> don't want to disable this globally, because we would want the >> compiler > > "we would want the code compiler to warn" Oops thanks. >> if we wrote that in real code. >> >> I filed a bug in GCC's bugzilla to suggest to add this warning: >> >> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81159 > > Thanks! > >> gdb/ChangeLog: >> >> * unittests/environ-selftests.c (run_tests): Ignore -Wself-move >> warning. >> --- >> gdb/unittests/environ-selftests.c | 9 +++++++++ >> 1 file changed, 9 insertions(+) >> >> diff --git a/gdb/unittests/environ-selftests.c >> b/gdb/unittests/environ-selftests.c >> index ecc3955..6989c5e 100644 >> --- a/gdb/unittests/environ-selftests.c >> +++ b/gdb/unittests/environ-selftests.c >> @@ -136,7 +136,16 @@ run_tests () >> env.clear (); >> env.set ("A", "1"); >> SELF_CHECK (strcmp (env.get ("A"), "1") == 0); >> + >> +#ifdef __clang__ >> +#pragma clang diagnostic push >> +#pragma clang diagnostic ignored "-Wself-move" >> +#endif /* __clang__ */ >> env = std::move (env); >> +#ifdef __clang__ >> +#pragma clang diagnostic pop >> +#endif /* __clang__ */ > > Wow. I know we've discussed this before, but this is ugly :-/. > Anyway, > this file is just a unittest, so I'm totally fine with this. 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?
On Wednesday, June 21 2017, Simon Marchi wrote: >>> gdb/ChangeLog: >>> >>> * unittests/environ-selftests.c (run_tests): Ignore -Wself-move >>> warning. >>> --- >>> gdb/unittests/environ-selftests.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/gdb/unittests/environ-selftests.c >>> b/gdb/unittests/environ-selftests.c >>> index ecc3955..6989c5e 100644 >>> --- a/gdb/unittests/environ-selftests.c >>> +++ b/gdb/unittests/environ-selftests.c >>> @@ -136,7 +136,16 @@ run_tests () >>> env.clear (); >>> env.set ("A", "1"); >>> SELF_CHECK (strcmp (env.get ("A"), "1") == 0); >>> + >>> +#ifdef __clang__ >>> +#pragma clang diagnostic push >>> +#pragma clang diagnostic ignored "-Wself-move" >>> +#endif /* __clang__ */ >>> env = std::move (env); >>> +#ifdef __clang__ >>> +#pragma clang diagnostic pop >>> +#endif /* __clang__ */ >> >> Wow. I know we've discussed this before, but this is ugly :-/. >> Anyway, >> this file is just a unittest, so I'm totally fine with this. > > 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? I'd prefer to leave the ifdef. It's just a small part in the "ugliness".
On 2017-06-21 22:29, Sergio Durigan Junior wrote: >> +#ifdef __clang__ >> +#pragma clang diagnostic push >> +#pragma clang diagnostic ignored "-Wself-move" >> +#endif /* __clang__ */ >> env = std::move (env); >> +#ifdef __clang__ >> +#pragma clang diagnostic pop >> +#endif /* __clang__ */ > Do you > think it's worth putting a comment on top, just to explicitly say what > this is doing? Forgot to reply to this. It seemed self-explanatory enough to me that ignoring the "self-move" warning just above a blatant self move was probably to silence a warning pointing out the self move :).
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
On Wednesday, June 21 2017, Simon Marchi wrote: > On 2017-06-21 22:29, Sergio Durigan Junior wrote: >>> +#ifdef __clang__ >>> +#pragma clang diagnostic push >>> +#pragma clang diagnostic ignored "-Wself-move" >>> +#endif /* __clang__ */ >>> env = std::move (env); >>> +#ifdef __clang__ >>> +#pragma clang diagnostic pop >>> +#endif /* __clang__ */ > >> Do you >> think it's worth putting a comment on top, just to explicitly say what >> this is doing? > > Forgot to reply to this. It seemed self-explanatory enough to me that > ignoring the "self-move" warning just above a blatant self move was > probably to silence a warning pointing out the self move :). Yeah, you're right. I just thought a comment in English would make it *even* clearer ;-). But that's just a personal preference, I don't mind. Cheers,
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.
On 2017-06-21 23:28, 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? Yes, but then it's GCC that complains that it doesn't know the warning: /home/emaisin/src/binutils-gdb/gdb/unittests/environ-selftests.c:141:32: error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas] #pragma GCC diagnostic ignored "-Wself-move" ^ > 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)) Oh that's interesting. The gcc doc said that _Pragma was added exactly for this purpose (to be usable in macros). I'll try that. > 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 guess that with a comment explaining why we use that it would be ok, but that would not be my first choice either. Thanks, Simon
On 06/22/2017 08:44 AM, Simon Marchi wrote: > On 2017-06-21 23:28, 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? > > Yes, but then it's GCC that complains that it doesn't know the warning: > > /home/emaisin/src/binutils-gdb/gdb/unittests/environ-selftests.c:141:32: > error: unknown option after ‘#pragma GCC diagnostic’ kind [-Werror=pragmas] > #pragma GCC diagnostic ignored "-Wself-move" > ^ > Ah, but that's a different kind of complaint. Since both compilers understand "#pragma GCC" but only one understands "#pragma clang", then it seems clearly better to me to write the infrastructure macros in terms of the former. It'll make it a bit easier to reuse the macros for other warnings. >> 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)) > > Oh that's interesting. The gcc doc said that _Pragma was added exactly > for this purpose (to be usable in macros). I'll try that. Right. Thanks, Pedro Alves
diff --git a/gdb/unittests/environ-selftests.c b/gdb/unittests/environ-selftests.c index ecc3955..6989c5e 100644 --- a/gdb/unittests/environ-selftests.c +++ b/gdb/unittests/environ-selftests.c @@ -136,7 +136,16 @@ run_tests () env.clear (); env.set ("A", "1"); SELF_CHECK (strcmp (env.get ("A"), "1") == 0); + +#ifdef __clang__ +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wself-move" +#endif /* __clang__ */ env = std::move (env); +#ifdef __clang__ +#pragma clang diagnostic pop +#endif /* __clang__ */ + SELF_CHECK (strcmp (env.get ("A"), "1") == 0); SELF_CHECK (strcmp (env.envp ()[0], "A=1") == 0); SELF_CHECK (env.envp ()[1] == NULL);