From patchwork Wed Aug 7 20:31:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ian Lance Taylor X-Patchwork-Id: 1970252 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=golang-org.20230601.gappssmtp.com header.i=@golang-org.20230601.gappssmtp.com header.a=rsa-sha256 header.s=20230601 header.b=ta+M+BYh; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=gcc.gnu.org (client-ip=8.43.85.97; helo=server2.sourceware.org; envelope-from=gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=patchwork.ozlabs.org) Received: from server2.sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WfMKw3WM4z1yfC for ; Thu, 8 Aug 2024 06:32:19 +1000 (AEST) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id F0C61385B532 for ; Wed, 7 Aug 2024 20:32:17 +0000 (GMT) X-Original-To: gcc-patches@gcc.gnu.org Delivered-To: gcc-patches@gcc.gnu.org Received: from mail-yw1-x112a.google.com (mail-yw1-x112a.google.com [IPv6:2607:f8b0:4864:20::112a]) by sourceware.org (Postfix) with ESMTPS id 47C383858C41 for ; Wed, 7 Aug 2024 20:31:55 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47C383858C41 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=golang.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=golang.org ARC-Filter: OpenARC Filter v1.0.0 sourceware.org 47C383858C41 Authentication-Results: server2.sourceware.org; arc=none smtp.remote-ip=2607:f8b0:4864:20::112a ARC-Seal: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723062717; cv=none; b=APTqb3jJ12rEpJYJ9H2aq6JJkoRohMGn6aY0YMcTNWpAtS7CCSixH6G5oQildIQ2A/3mDr/Jdf3hOCIOnj+/OQ/fvJjLdYL1rXDBksxU6UFhOQUz7NqpRfEfjRxtEGlCTkNkOQbt7Ddt1bQC14JuAwp/VmJ6v3hLIAKXgUstDT0= ARC-Message-Signature: i=1; a=rsa-sha256; d=sourceware.org; s=key; t=1723062717; c=relaxed/simple; bh=EscLq/PJWQIoEHyYAkbB1jgyPy5Bcq+sJZO6UPmiFbM=; h=DKIM-Signature:MIME-Version:From:Date:Message-ID:Subject:To; b=AFwj7Mjc81ISbMxsW2kZvl/gmorTSSFCbD+mi7T2uFviOLCcK5px92sa9MbEx28Yv1G2Mm+3sRMnn+TIahsgafQR4NgIGI2ndFlfwmAnbzttgyBmOOwqO2qdhjAArI4brZkydvT6nuYy3y4lqmaIF21E2msFaKlC+dNikmvZAKg= ARC-Authentication-Results: i=1; server2.sourceware.org Received: by mail-yw1-x112a.google.com with SMTP id 00721157ae682-68aa9c894c7so2510167b3.1 for ; Wed, 07 Aug 2024 13:31:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=golang-org.20230601.gappssmtp.com; s=20230601; t=1723062714; x=1723667514; darn=gcc.gnu.org; h=to:subject:message-id:date:from:mime-version:from:to:cc:subject :date:message-id:reply-to; bh=+ivSTZbdAksNmuyvA1bD8JgDihb8DRRwGy810KTEnEY=; b=ta+M+BYh0CiFoqxdjNL47kf3i936SYI7w9XbYpwKizvNmnZbXZrieeSrFfn6tPJ60H KLbVx0lqurFdmVPiNthcrA6zSa7LsTggDy3UCC7JodPjJb+lbvFvv6mI50kXXacfHEcf 8kgYh4obMTmyk/ioBbd9BaQQuMvJAikYsMX92QxCSDqOpUM+TI6gI0buHARKK8rNfaO6 ve9ubtCX1stt4ulAqk8N43psyaHm8V96BZBLQG5z0Nq3qQwhVHjb3n0TBNhrKYH10Ksu Oao7EO/9e0T4FXUCVVgfung8Bzm5oKsRbwh9Dq6ZAeQbqDBgKZ0rwyPRrAI1XYU/eKxk omtQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1723062714; x=1723667514; h=to:subject:message-id:date:from:mime-version:x-gm-message-state :from:to:cc:subject:date:message-id:reply-to; bh=+ivSTZbdAksNmuyvA1bD8JgDihb8DRRwGy810KTEnEY=; b=MdPuYXpOOgcOxamv0ScXBYI1btpsJBaBAPPNU+nqsU21FSjTImgGkh06grarXxmNhs VzfYh3CjwS7IChS9C5ZW90VjVNHUUqfpnzaKe2PVM58riLJtWsavgfLyesScgzKHK2Ns XY9qgMsel9w7JjeYZbK/9fL4btVRW/MlV1RVcwFlFHM/hEV1GSiWjqnDZewUyAROqJsG 2nQw3gx/ZtX1yaPfBK0KuTozlINFCOwMxkRQiiSOIG88ZtIeu7AM2OzGnOQixznt1vU3 vP+OR+xPNAygc9BG3X7Fglyc9Q9wwByqHzKWbUa6zr34yVhcTbXr8wxamfM2LtkUlLMg O5sA== X-Gm-Message-State: AOJu0YwapE3dg3SIURnwfaaXKh6zz5+ljXtN7ORTsv7eeILr1z0JOvnF SHnlR0229xzuveVgUY1s4EAceb8QTElcU2BL8yVMO0jqxpBGyrQPBoOLAu/Ey4Q6CVdSD7fWbnJ l9NxuQZ4wa/By/ihCYD5i8vnXQAStKhI5WKG8gytLHr9tVWOc X-Google-Smtp-Source: AGHT+IFG3h5L3rvd893lLUOarmptzQ1k17ZEpsbX2Udnu0eRpbTS2KDetPWRzSQrmkNA8Thp+b4GaSZsUMHbwSwD9Jk= X-Received: by 2002:a05:690c:6612:b0:62c:c62e:e0db with SMTP id 00721157ae682-6994e6886cbmr39474107b3.44.1723062714274; Wed, 07 Aug 2024 13:31:54 -0700 (PDT) MIME-Version: 1.0 From: Ian Lance Taylor Date: Wed, 7 Aug 2024 13:31:42 -0700 Message-ID: Subject: Go patch committed: Don't assume that ATTRIBUTE_UNUSED is defined To: gcc-patches , gofrontend-dev X-Spam-Status: No, score=-9.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, 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 X-BeenThere: gcc-patches@gcc.gnu.org X-Mailman-Version: 2.1.30 Precedence: list List-Id: Gcc-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: gcc-patches-bounces~incoming=patchwork.ozlabs.org@gcc.gnu.org This patch to the Go frontend avoids assuming that ATTRIBUTE_UNUSED is defined. While it is defined when building the Go frontend as part of GCC, it is meant to work with other compilers as well. Bootstrapped and ran Go testsuite on x86_64-pc-linux-gnu. Committed to mainline. Ian e89ddb749517ea4c9c0ecf32f6932548140c0dcc diff --git a/gcc/go/gofrontend/MERGE b/gcc/go/gofrontend/MERGE index e13dc5f58a3..3a839410e9c 100644 --- a/gcc/go/gofrontend/MERGE +++ b/gcc/go/gofrontend/MERGE @@ -1,4 +1,4 @@ -5f6fae5ff33e996243acd098c71904695c414c53 +6aa463fef2d8f04e0bd2675f63a6529df080a44a The first line of this file holds the git revision number of the last merge done from the gofrontend repository. diff --git a/gcc/go/gofrontend/lex.h b/gcc/go/gofrontend/lex.h index 701e5d4b353..452ef95f334 100644 --- a/gcc/go/gofrontend/lex.h +++ b/gcc/go/gofrontend/lex.h @@ -12,6 +12,12 @@ #include "operator.h" #include "go-linemap.h" +#if __GNUC__ > 3 || (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# define GO_ATTRIBUTE_UNUSED __attribute__ ((__unused__)) +#else +# define GO_ATTRIBUTE_UNUSED +#endif + struct Unicode_range; // The keywords. These must be in sorted order, other than @@ -561,7 +567,7 @@ class Lex gather_embed(const char*, const char*); // The input file name. - const char* input_file_name_ ATTRIBUTE_UNUSED; + const char* input_file_name_ GO_ATTRIBUTE_UNUSED; // The input file. FILE* input_file_; // The object used to keep track of file names and line numbers.