From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by sourceware.org (Postfix) with ESMTPS id E78E53858C35 for ; Mon, 16 Oct 2023 14:13:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E78E53858C35 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com ARC-Filter: OpenARC Filter v1.0.0 sourceware.org E78E53858C35 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=170.10.133.124 ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697465626; cv=none; b=HffzQEP+4jPwBECBSIgfk9QzTx8lVWTxoEb1c0lHNGmNSopU/sXwt1ejs18wbhUL74ZfvijxBB2t1kd40tSGBATmSZzunnhYMURMVwUYJZKz5+a2bl78V7+OtH5MNAVpLJ6cj9YNy8uZQjrr5cz1xBnIkMWdXLNZVIvgigdMh40= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1697465626; c=relaxed/simple; bh=91VGbxZQ4LAnzQIi16qfwhM7ZzkA7bQ/FrwPFuExupA=; h=DKIM-Signature:From:To:Subject:Date:Message-ID:MIME-Version; b=kLbw4tM1QJIbz1zLYXJTo/VYurnu7/980VoFG9977hxTsNiuoZT7vgFHhIRn7FqaR1oW+oU3Fu5uueO2CKhCH8zDlEt2uu4YCO7nAMtW+EK56awPzt0PcLWmk/kUuufzQZ9rgqzBtA1SSNMT8BvXRUgnk1clRS1YwdtDWJuWaFE= ARC-Authentication-Results: i=1; server2.sourceware.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1697465624; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=hiKcTVvMUblsf//uDRP++6u8aJU50XwKg2DZg3EvDC0=; b=CCiiYNbuDsGp8SZmsBt+YljbLT7B+WTmNJQ07EZMnV+Gu7lNbfEESpoVdUCA2CDEV11SRW jYaOD9zVa5NBEYNNp45nR04LPtylDWTONGxMx/y2eraVvuCYKDO03u436YprhmuowbgvnM WMCQjAIhSvZ3lL7nS0yd5XoSWHYm0xU= Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-398-Ueb3teufNNqwJxOqPmQJGw-1; Mon, 16 Oct 2023 10:13:37 -0400 X-MC-Unique: Ueb3teufNNqwJxOqPmQJGw-1 Received: by mail-qt1-f197.google.com with SMTP id d75a77b69052e-4180bc4227bso86039121cf.1 for ; Mon, 16 Oct 2023 07:13:36 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1697465616; x=1698070416; h=mime-version:message-id:date:references:in-reply-to:subject:cc:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=hiKcTVvMUblsf//uDRP++6u8aJU50XwKg2DZg3EvDC0=; b=w3vOLgBd2jOkImIA6/zFALsOlNfGFj2lziv4i0ZPEIfrnBnEc6oH9ujXL8OGp9mH8H UkXibxCMP1IdVufDwG9PvX3LYpUUuUCay4vXV7+JijD1E8F1YNZ4i4qliFxyzeSlEgJv SgtHUsbIXjrqfTva9O2EhQ2uqBvp978CgQ/strfHveALbfPl3wcNaGlGZOY0pE0NbJck 2HsRmlr9jlAx8oxz5pqqzu9asgnYNd4Vgzm4sW3JDJ+yomZVCR1bvq4lR4tu/TasFbkk bzFlUE+XwssMs/gY8KE6gEbPz0/vndKBd4Rkc8QX6iA2MepY2cCgAWJoXBlzyZGHi4wq R8Dg== X-Gm-Message-State: AOJu0YzhrVsIyjgkUL4rA3Xw04dbpYvRXeNuzZcdDcupTnRTyJ7IXDVP vMgyuwDjtHFerNy1OymYrPnK8A6iu2/D/Ysz9hxIrAMQ9oV+NlEny2UrV8QnAyqg+OVdCfT/wCG YqH0SCk5bwWbzBKRZdIo99UNTppWh9Q== X-Received: by 2002:a05:6214:76e:b0:656:3045:5638 with SMTP id f14-20020a056214076e00b0065630455638mr12196478qvz.16.1697465616233; Mon, 16 Oct 2023 07:13:36 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHSmPbTQtOeTpBJUBkMaAiveQWTyJd5uje3qHJsLD5JQxyg7G9fvOiaAO/jGq6ANZ8/izdt0w== X-Received: by 2002:a05:6214:76e:b0:656:3045:5638 with SMTP id f14-20020a056214076e00b0065630455638mr12196276qvz.16.1697465614363; Mon, 16 Oct 2023 07:13:34 -0700 (PDT) Received: from localhost ([31.111.84.209]) by smtp.gmail.com with ESMTPSA id ei16-20020ad45a10000000b0066cf2423c79sm3446340qvb.139.2023.10.16.07.13.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 16 Oct 2023 07:13:33 -0700 (PDT) From: Andrew Burgess To: Tom Tromey Cc: Tom Tromey via Gdb-patches , Tom Tromey Subject: Re: [PATCH] Use std::optional when available In-Reply-To: <874jiywhfs.fsf@tromey.com> References: <20231005160543.2627733-1-tromey@adacore.com> <87y1gcc6kt.fsf@redhat.com> <874jiywhfs.fsf@tromey.com> Date: Mon, 16 Oct 2023 15:13:31 +0100 Message-ID: <87fs2ahcz8.fsf@redhat.com> MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-5.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Tom Tromey writes: >>>>>> "Andrew" == Andrew Burgess writes: > > Andrew> I think this change needs to be held off until we move to C++17 - at > Andrew> which point gdb::optional can just be dropped. > > Once we switch I think we can just remove this code entirely. > > GDB 14 branched, so I think we're ready for that now. > >>> +#if __cplusplus < 201703L > > Andrew> Ignoring my previous comment for a moment; we now rely on this version > Andrew> number being defined the same in two files. Would it be better to move > Andrew> the '#define GDB_OPTIONAL' into gdb_optional.h? Then we can be certain > Andrew> that it will be defined correctly, and in sync with any future changes > Andrew> made in that file? > > I don't think that would really help. IIUC the issue would be compiling > two source files with different -std settings. But in this case > gdb_optional.h would react to this. Maybe I'm not understanding what > you mean though. I think you agreed above that we can just move to C++17 and then we'll just move to std::optional throughout, and, like Pedro says, all these tests will go. If I'm wrong, and you would like me to explain what I was driving at, just let me know and I'll draft a patch to explain what I mean. > It seems to me that we simply don't need to support compiling the tree > with different std settings for different files -- it should be fine to > just assume that everything is compiled compatibly. Yeah, I would expect the result of using different std settings to be "undefined", might work, but don't be surprised if it doesn't. Thanks, Andrew