From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by sourceware.org (Postfix) with ESMTPS id 2998E3858D33 for ; Fri, 2 Dec 2022 14:39:42 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 2998E3858D33 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=adacore.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=adacore.com Received: by mail-ej1-x62a.google.com with SMTP id n20so12102593ejh.0 for ; Fri, 02 Dec 2022 06:39:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=adacore.com; s=google; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=NhfnqeeGraPeCWH+kKroTmhP1DTRb2daywDEWSvP/CA=; b=TO86wYC+alXDTNAMxoO2NsCBHKX3SMJs4PIVALan1Gaij5VMbThz+hAfxEIOIH70qb IwqB07R5oUo3aaltcf0c+z4mmx1yRP5uLpIPyVp1gxSfuJ4NvzHSLwXoQ3ggC5pN+6dd lmMFH2NwJswaGlVDWm2KyBQVd3u7MGetQhMazX2Y56HMuSxMDQ+NxyOsqq+pp+5gC6ya mMNsDWmwYdoFZCNmW8a7QWwsfE8sSSk0qOUGcI2bBuv5//6dphU2IPOxCl2kxaVnnbze 4E94JOSmIN84RMVL7aFXBP3VFNTQHTJ4IfBKm+cOsw77SV3Bbi5a6jgDbhrEX+PUWxSi b4/Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:user-agent:references:in-reply-to :subject:cc:to:from:x-gm-message-state:from:to:cc:subject:date :message-id:reply-to; bh=NhfnqeeGraPeCWH+kKroTmhP1DTRb2daywDEWSvP/CA=; b=nN0kXytnrabvJ5EvVJCA6K+IvDZIaYOhNX/P/EQVTz0IozIepw8Zson+TYAr5ARR7q xIC1ySw02/k/OnhTAmvyBkIOkUmqYMgVYTKTHcvvMWv9Vr14YCp2H9Cerj5fKZvq1ugt ccNAqrAbwiMiiAPuBdD0LGRaRi2GhuI5CRkRMbmaxPSJ4T4qF7MA9uDQEgQsO/zhKCrf qEQwJWwOMXdC6K0/i6WEEHun8Ic4E3dtWr6LB/mc8Wd473cr+JUO2+l7UZorz0L7QEHJ /I5dTozP3zBIiTveZQ6hF4ola0W2+MIpUAa4upNtAJcYx08bL9XOM856ebzPps2v/2K8 6BNw== X-Gm-Message-State: ANoB5pnB33FiPvrKZsRAUY7LpaItx9fhgPD5OqnI00JNLRvjNbM+l1J/ FwDyPWeRKLghDhAiy4jEdAwslg== X-Google-Smtp-Source: AA0mqf47jLUGyFKMxTJbSE6znNogANCxOE7YNcLuFwPdoQRg3FmBgnrQhqZ6fAV4N8aVxQ3Cl4B8Tg== X-Received: by 2002:a17:907:234c:b0:7c0:911d:6303 with SMTP id we12-20020a170907234c00b007c0911d6303mr14138338ejb.703.1669991980756; Fri, 02 Dec 2022 06:39:40 -0800 (PST) Received: from murgatroyd ([2620:20:4000:100::1000]) by smtp.gmail.com with ESMTPSA id c20-20020a056402159400b0046a0096bfdfsm3013241edv.52.2022.12.02.06.39.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 02 Dec 2022 06:39:40 -0800 (PST) From: Tom Tromey To: Andrew Burgess Cc: Tom Tromey , gdb-patches@sourceware.org Subject: Re: [PATCH 3/3] Add name canonicalization for C In-Reply-To: <20221201232348.GD2415@redhat.com> (Andrew Burgess's message of "Thu, 1 Dec 2022 23:23:48 +0000") References: <20221107162356.3175221-1-tromey@adacore.com> <20221107162356.3175221-4-tromey@adacore.com> <20221201232348.GD2415@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) X-Attribution: Tom Date: Fri, 02 Dec 2022 07:39:02 -0700 Message-ID: <87sfhxlvjt.fsf@tromey.com> MIME-Version: 1.0 Content-Type: text/plain X-Spam-Status: No, score=-4.7 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,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: >>>>> "Andrew" == Andrew Burgess writes: >> struct type * >> lookup_signed_typename (const struct language_defn *language, const char *name) >> { >> - struct type *t; >> - char *uns = (char *) alloca (strlen (name) + 8); >> - >> - strcpy (uns, "signed "); >> - strcpy (uns + 7, name); >> - t = lookup_typename (language, uns, NULL, 1); >> - /* If we don't find "signed FOO" just try again with plain "FOO". */ >> - if (t != NULL) >> - return t; >> + /* In C and C++, "char" and "signed char" are distinct types. */ >> + if (streq (name, "char")) >> + name = "signed char"; Andrew> I wondered why this "char" -> "signed char" conversion is done Andrew> unconditionally for all languages, when the comment hints that the Andrew> conversion only applies for C/C++? I guess I would have expected a Andrew> language check here. lookup_signed_typename is only used by C and C-like languages. For non-C-like languages, sticking a "signed" (or "unsigned", see lookup_unsigned_typename) prefix on a type name doesn't really make sense anyway. The uses outside c-exp.y are, IMNSHO, just leftover code from the bad old days. Like, I suspect there's no reason to have binop_promote at all, instead this could be an explicit node in the expression tree, and rather than having a big 'switch' on the language, each language could simply make a different node. Tom