From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wm1-x343.google.com (mail-wm1-x343.google.com [IPv6:2a00:1450:4864:20::343]) by sourceware.org (Postfix) with ESMTPS id D91E038618D9 for ; Fri, 21 Aug 2020 15:57:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org D91E038618D9 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=embecosm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=andrew.burgess@embecosm.com Received: by mail-wm1-x343.google.com with SMTP id t14so2325620wmi.3 for ; Fri, 21 Aug 2020 08:57:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=embecosm.com; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=xIWtqRmpWjOqL8WDu5pNL5x3OupzYzutigSOOfePctk=; b=dBSW6tPpGEJAQN96BQSyxM3gRs9IfqV1dnKdjF6vWr4eMj6Br/WIc/dV9DkodNNy2i pI8MuiMIxsByLWm3YOOy/m59SvTNX3rAYNbcEKmx8e7GlElZHa9rmi3u/ujP02HaJfgO MoGOL49nDbggfIX7U2wWey8pFaju8mpjnIMARJsBovA5FLhoegfxPMy7ZgPMSrAA4v/0 /YV/iFsyMpY4Lsb6WvgyBoTBXsiwEzhpHlQIoizSw8ZmA05pahB1/8fl+fucMqW9g5CG JBH+TfaB11ZqN1R0T3b9NejNE93K19awdz+pgupYs3BdoXlPVdIyJC8Zf2c3UDNYCLEj TSbg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=xIWtqRmpWjOqL8WDu5pNL5x3OupzYzutigSOOfePctk=; b=VjjjMRfSHEbe13XDaKYlIfYM6SduokfU4bY1CMMnNQ/PlDwt4AAGL5Z2rZoCcrPKs8 jmMmNOKw9x2gs+oYszNJ+5oHWMiWwVyYJDOft6mqibIa87nA3OEy5FMP479fqG4j/rY7 0mEXkD19bpZGmOvy/8TJ3AMGT5UeWk0H9E/8XigSLGR8N/P/jsD5HGQI7YMILchu4XXT lTsLcu28t8TSx1AL/p2h7glEyu43Lc5g2E74cKDhPmpm69NpynqZ/b26bwkXHGNoFR9S gQ3b7Xpd0Cp2Xp06/9ZqMMSDrw8j3d9g8uCzBviMOox/RpKJg9pScBfly3mJ0ty64l3c SFOw== X-Gm-Message-State: AOAM530x0O0lZZjOMfFPYUS7rFsXKextxOMqqE+IE9LOVjBiR0WOZ1hr wxCht1hdTcAkuZ4+kdqnowKOaw== X-Google-Smtp-Source: ABdhPJxU/nBe+S6xgSsW28D9erp0MeTIZGD0RE178R1nf4+3olXDsWYSvaC7cMyTqgFyGO1PxysyrQ== X-Received: by 2002:a1c:740c:: with SMTP id p12mr3713846wmc.53.1598025463791; Fri, 21 Aug 2020 08:57:43 -0700 (PDT) Received: from localhost (host86-140-92-120.range86-140.btcentralplus.com. [86.140.92.120]) by smtp.gmail.com with ESMTPSA id g12sm5661412wmh.40.2020.08.21.08.57.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 21 Aug 2020 08:57:43 -0700 (PDT) Date: Fri, 21 Aug 2020 16:57:42 +0100 From: Andrew Burgess To: Pedro Alves Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 1/8] gdbsupport: Provide global operators |=, &=, and ^= for enum bit flags Message-ID: <20200821155742.GP853475@embecosm.com> References: <8eb7f409ca572c526de08ab23878be905f5fef42.1597319264.git.andrew.burgess@embecosm.com> <87a6yvhls1.fsf@tromey.com> <20200817104034.GJ853475@embecosm.com> <89e07f2d-9c33-5f43-d62f-19571ac39c57@palves.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <89e07f2d-9c33-5f43-d62f-19571ac39c57@palves.net> X-Operating-System: Linux/5.6.15-200.fc31.x86_64 (x86_64) X-Uptime: 16:52:17 up 34 days, 1:06, X-Editor: GNU Emacs [ http://www.gnu.org/software/emacs ] X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_BARRACUDACENTRAL, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 21 Aug 2020 15:57:46 -0000 * Pedro Alves [2020-08-21 15:49:15 +0100]: > On 8/17/20 11:40 AM, Andrew Burgess wrote: > > > > > 3. Instead of writing 'enum some_flag', a developer might just write > > 'some_flag'. > > I suspect you meant 'some_flags' in the latter case. No, I meant 'some_flag'. > > > In this case they still require the changes from my > > patch if they ever want to use operator|=. I think spotting the > > missing 's' is much harder during review, > > I'd argue that that's an issue of naming. If people thing it's a > problem, we can use a more distinct name for the raw enums. > Some cases use enum foo_flag_value / foo_flags, which seems reasonable > to me. I don't understand where 'enum foo_flag_value' came from, so I can't really respond to this. > > > so it's easy for uses of > > 'some_flag' to creep into the code base, then a future developer > > wanting to use 'operator|=' will need to fix up the 'some_flag' to > > 'some_flags' miss-match. Though it's easy to argue that the first > > developer made a mistake, and we frequently have to fix the mistakes > > of those going before, in this case we don't have to, so why force > > the matter? > > > > I guess my argument would be, lets commit. We should either remove > > the existing global operators from enum-flags.h, fix up the fall out, > > and so make it much harder to developers to use the 'some_flag' > > version (so forcing the use of 'some_flags'), or make the change I > > propose which allows the full range of operators while loosing non of > > the protection that already exists. > > This (again) reminded me of my enum-flags.h rewrite that I never > managed to commit... > > I spent time around it yesterday/today, and posted it here: > https://sourceware.org/pipermail/gdb-patches/2020-August/171392.html I saw this. Once this gets merged I'll rebase the rest of my series on top of your work, at which point I assume that this patch will not be required. Thanks for your help, Andrew > > Thanks, > Pedro Alves