From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-qv1-f46.google.com (mail-qv1-f46.google.com [209.85.219.46]) by mx.groups.io with SMTP id smtpd.web12.20303.1611809640341782554 for ; Wed, 27 Jan 2021 20:54:00 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=hut2297G; spf=pass (domain: nuviainc.com, ip: 209.85.219.46, mailfrom: rebecca@nuviainc.com) Received: by mail-qv1-f46.google.com with SMTP id a1so2238141qvd.13 for ; Wed, 27 Jan 2021 20:54:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=subject:to:cc:references:from:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=mO0AYG5SYnjcjdT1r0YUNiwjlrAGZVVmCYDkr9H2gJk=; b=hut2297GSz3HT5PEVoGGjZsBp3VX95ReAFwQCNYp++N4WScOLWW3JN66P4ien32WVl 89WO1Z9b/dNDnEaCwIP32JocAoHPSWB3KYkYkmVF28jI63PHyP/0bmY7jOu37ekxtz57 ybU9+QLfEZ57bqAB7tpeVCsigHEpPSCW+sM5MNJ1bSLLKp7gNARwZcXDu4YKjSeqNzX7 TPu6kXLMoN3BOHxoKDEgjqjr7jCPb9zf+2yyteIweSLs4SskDqX3anR9F3pLM+fmZRf3 71RW3hG5zqCcGiIkerRa5HLaD/N2UXIUt4FSF42E2vcYWT9A03zX7E837YjBYekYZNa8 dQtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=mO0AYG5SYnjcjdT1r0YUNiwjlrAGZVVmCYDkr9H2gJk=; b=uIhWToaBuje/YoSArz7aj/Rj89uZbwpq1gPbq6tN7P/VU1bsGX7OpjDEi6xitPOVYI JXDTaD+PRFvwbwFb08eSU4GJTz/I2A4d5BVD2wZGzU56AIPjF5Og1MbNvfX/stZGta4q uvTwK8V4cpFvhbZ7P4IxiChMxZkNNSVkZvoSDsqyEQYgdJ2d7rMEzgOxPvlesjD9DpJ1 pdUrfmaei4j4X65XT2P/vmkUOVIqqsSxilHXMHLjSZcNTjTbGAa6mgDZOZ3LVS9U/o7b P/XX38m9hGfplOEWGcUxpLx3x+TFD3FQAGIrv8nLDSH00eWRIt6/qRl3pnUUyeA/716P j+gw== X-Gm-Message-State: AOAM53241sKyzYDs+fY34favBxCZwhktuDSCFb5ldwZeuvrMF273SeT5 5kxfNSmypTyYgV0g7Apz6su8CA== X-Google-Smtp-Source: ABdhPJyJoCqukdFwLufeYhNl64PKl2UcBOnnt+PiDZ5Idu3cDkSpBoY3pR1A/PMVMW9cOdg0uYkPtg== X-Received: by 2002:a0c:8b4a:: with SMTP id d10mr13518039qvc.14.1611809639504; Wed, 27 Jan 2021 20:53:59 -0800 (PST) Return-Path: Received: from [10.0.10.142] (c-174-52-16-57.hsd1.ut.comcast.net. [174.52.16.57]) by smtp.gmail.com with ESMTPSA id 186sm2748157qkh.30.2021.01.27.20.53.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 27 Jan 2021 20:53:59 -0800 (PST) Subject: Re: [PATCH v6 14/22] ArmPkg: Add Universal/Smbios/ProcessorSubClassDxe To: Leif Lindholm Cc: devel@edk2.groups.io, Ard Biesheuvel , nd@arm.com, Sami Mujawar , Liming Gao , Michael D Kinney , Zhiguang Liu , Samer El-Haj-Mahmoud References: <20210114163628.31952-1-rebecca@nuviainc.com> <20210114163628.31952-15-rebecca@nuviainc.com> <20210125190417.GE1664@vanye> From: "Rebecca Cran" Message-ID: <6fa39599-5ec0-38f3-6eb0-f857c601fb8a@nuviainc.com> Date: Wed, 27 Jan 2021 21:53:57 -0700 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.6.1 MIME-Version: 1.0 In-Reply-To: <20210125190417.GE1664@vanye> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit On 1/25/21 12:04 PM, Leif Lindholm wrote: > On Thu, Jan 14, 2021 at 09:36:20 -0700, Rebecca Cran wrote: >> +// Sets the HII variable `x` if `pcd` isn't empty >> +#define SET_HII_STRING_IF_PCD_NOT_EMPTY(pcd, x) \ >> + x##Str = (CHAR16 *)PcdGetPtr (pcd); \ >> + if (StrLen (x##Str) > 0) { \ >> + HiiSetString (mHiiHandle, x, x##Str, NULL); \ >> + } \ > > I am not a fan of preprocessor macros that require local variables > with magic names to exist. > Can this be rewritten as a helper function? Unfortunately PcdGetPtr uses token pasting, so a helper function won't work. Would the following be better? #define SetHiiStringIfPcdNotEmpty(Pcd, StringId) { \ CHAR16 *Str = (CHAR16*)PcdGetPtr (Pcd); \ if (StrLen (Str) > 0) { \ HiiSetString (mHiiHandle, StringId, Str, NULL); \ } \ } -- Rebecca Cran