From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-yb1-f195.google.com (mail-yb1-f195.google.com [209.85.219.195]) by mx.groups.io with SMTP id smtpd.web10.3142.1574920612153467261 for ; Wed, 27 Nov 2019 21:56:52 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=G/z9djiT; spf=pass (domain: gmail.com, ip: 209.85.219.195, mailfrom: theracermaster@gmail.com) Received: by mail-yb1-f195.google.com with SMTP id n3so6297446ybm.7 for ; Wed, 27 Nov 2019 21:56:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=REWN5cUNHZzDBpX6SGn7CTbY9LCsbVaJ8I1aQObV9Ck=; b=G/z9djiTAapZn17bYD3SLI5hO8Z3jTdSrI/LLJcPfQIYAEaP08ugG+09wXtxsOH/BS Dj04qZfnscMXLbrm5eTheQKHrKC8Ova5aLfHQj4YAsAa9Ud0dQEZdZ9G98gxbaEGvjuc bRoi1TIL0AeDbqcYfNCoNY8xL+TKzXE0b7OFSgGX4BI6C6gJS18sd/vAJi8ZSBC+iKYi 8rQkzdmRm8X9rr7FJSXOFUPYzZxr6elpBjfeeItwfKReLkl64DTc6/LaRrd26ysyiFMN 7V38/gLxpOKfFIq9i5P0R+jxdc/7MxIw5Gm902AzFVHZFtfjNjnpt32vd5O/9yfrlNa1 qhDQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=REWN5cUNHZzDBpX6SGn7CTbY9LCsbVaJ8I1aQObV9Ck=; b=qFAOLpxu07rp4equtu1//NowiVHX7AKvv6xZz+0fm+yyVKg/7bklbxCNyOzF0VgjNq vMf16MeFDkoyKMeJXqNNLwr/Gd4gAbktPf3B7Ygt93c1eFIb1XMM5ig1wsaMcz+ZKn+p 9Q5NDH2Nym5TktEpee+JFNOk2Tt88kL/Rqt2Ri1Q95ns0cViJYDVjORsQfL1hG3c0eXM ddRiExx/B/Py7n8IT0541xmVYH+taYIXaGcPdj4v0hv8rNZP1DWDmgpBdQziO2F7gEBi J9cd2nPzPDj8HcNHI7F4g4qZ88DXDq9ycA/2e3kqrwVhjS2RCKPv5rSpsXD3Zkzz13Fk 84nQ== X-Gm-Message-State: APjAAAU6ItvOH6T3Qn+E/oFv+nRtKq5RCU00c0ZSh90dCHrUlw3L+9Qx BuB9b3c98IoM0YrvPvdTgGGCoVKo X-Google-Smtp-Source: APXvYqw4tjLPoItR4nqKHABAzsJZfgKSv0N+XooseN8qMndMozbGFUlsub5qs384TT3b4rQXImfxUA== X-Received: by 2002:a25:d951:: with SMTP id q78mr21309819ybg.102.1574920611215; Wed, 27 Nov 2019 21:56:51 -0800 (PST) Return-Path: Received: from localhost.localdomain (c-73-73-210-170.hsd1.il.comcast.net. [73.73.210.170]) by smtp.gmail.com with ESMTPSA id 64sm8139227ywg.103.2019.11.27.21.56.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 27 Nov 2019 21:56:50 -0800 (PST) From: "Alex James" To: devel@edk2.groups.io Cc: Michael D Kinney , Liming Gao Subject: [PATCH v1] MdePkg: Use __builtin_offset with CLANGPDB toolchain Date: Wed, 27 Nov 2019 23:56:45 -0600 Message-Id: <20191128055645.53053-1-theracermaster@gmail.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable CLANGPDB does not define __GNUC__, but it does define __clang__. Check for the __clang__ preprocessor definition to use __builtin_offsetof to implement the OFFSET_OF macro. Cc: Michael D Kinney Cc: Liming Gao Signed-off-by: Alex James --- MdePkg/Include/Base.h | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/MdePkg/Include/Base.h b/MdePkg/Include/Base.h index 4680e64136..e0bcd0ae67 100644 --- a/MdePkg/Include/Base.h +++ b/MdePkg/Include/Base.h @@ -781,11 +781,9 @@ typedef UINTN *BASE_LIST; @return Offset, in bytes, of field.=0D =0D **/=0D -#ifdef __GNUC__=0D -#if __GNUC__ >=3D 4=0D +#if (defined(__GNUC__) && __GNUC__ >=3D 4) || defined(__clang__)=0D #define OFFSET_OF(TYPE, Field) ((UINTN) __builtin_offsetof(TYPE, Field))=0D #endif=0D -#endif=0D =0D #ifndef OFFSET_OF=0D #define OFFSET_OF(TYPE, Field) ((UINTN) &(((TYPE *)0)->Field))=0D --=20 2.24.0