From patchwork Wed Feb 8 19:52:21 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Leoshkevich X-Patchwork-Id: 64498 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 7D08F3858022 for ; Wed, 8 Feb 2023 19:53:03 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 7D08F3858022 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675885983; bh=oXDtSD4zhN/8ks/1ziNkjkENriUOOVOzU2Fcx0os+nM=; h=To:Cc:Subject:Date:In-Reply-To:References:List-Id: List-Unsubscribe:List-Archive:List-Help:List-Subscribe:From: Reply-To:From; b=n1+KRw+hRjzUeXtVSbQQOTtnyZhlU9diokvIdWFX9OysFghrCJYK60qgw7obF6S1v FlTbRsC0bodCZ2YlUdigvZC/ENGpUemTgbULfA1nBFzMbmnfCMyl+WWPS6/KgAnlKA bjSs97B8qyxF/2gLbg5jIrpHEe0ZJHlzbXpgDU/c= X-Original-To: elfutils-devel@sourceware.org Delivered-To: elfutils-devel@sourceware.org Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) by sourceware.org (Postfix) with ESMTPS id C30973858D39 for ; Wed, 8 Feb 2023 19:52:52 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org C30973858D39 Received: from pps.filterd (m0098419.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 318Jm96V015362; Wed, 8 Feb 2023 19:52:37 GMT Received: from ppma06fra.de.ibm.com (48.49.7a9f.ip4.static.sl-reverse.com [159.122.73.72]) by mx0b-001b2d01.pphosted.com (PPS) with ESMTPS id 3nmj7a827b-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:36 +0000 Received: from pps.filterd (ppma06fra.de.ibm.com [127.0.0.1]) by ppma06fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 3183i5hF022813; Wed, 8 Feb 2023 19:52:35 GMT Received: from smtprelay06.fra02v.mail.ibm.com ([9.218.2.230]) by ppma06fra.de.ibm.com (PPS) with ESMTPS id 3nhemfksma-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 08 Feb 2023 19:52:35 +0000 Received: from smtpav06.fra02v.mail.ibm.com (smtpav06.fra02v.mail.ibm.com [10.20.54.105]) by smtprelay06.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 318JqVRU21103146 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 8 Feb 2023 19:52:31 GMT Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 5B23D20049; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) Received: from smtpav06.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 15A7E20043; Wed, 8 Feb 2023 19:52:31 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.179.24.149]) by smtpav06.fra02v.mail.ibm.com (Postfix) with ESMTP; Wed, 8 Feb 2023 19:52:30 +0000 (GMT) To: Mark Wielaard Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v2 2/7] printversion: Fix unused variable Date: Wed, 8 Feb 2023 20:52:21 +0100 Message-Id: <20230208195226.144143-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230208195226.144143-1-iii@linux.ibm.com> References: <20230208195226.144143-1-iii@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-GUID: FCEzTwXxdt2lqY6UL29IaaQnwhEwAD4- X-Proofpoint-ORIG-GUID: FCEzTwXxdt2lqY6UL29IaaQnwhEwAD4- X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.122.1 definitions=2023-02-08_09,2023-02-08_02,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 mlxlogscore=999 lowpriorityscore=0 clxscore=1015 malwarescore=0 bulkscore=0 spamscore=0 adultscore=0 priorityscore=1501 mlxscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302080167 X-Spam-Status: No, score=-12.1 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_MSPIKE_H2, 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: elfutils-devel@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Elfutils-devel mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-Patchwork-Original-From: Ilya Leoshkevich via Elfutils-devel From: Ilya Leoshkevich Reply-To: Ilya Leoshkevich Errors-To: elfutils-devel-bounces+patchwork=sourceware.org@sourceware.org Sender: "Elfutils-devel" clang complains: debuginfod.cxx:354:1: error: unused variable 'apba__' [-Werror,-Wunused-const-variable] ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; ^ ../lib/printversion.h:47:21: note: expanded from macro 'ARGP_PROGRAM_BUG_ADDRESS_DEF' const char *const apba__ __asm ("argp_program_bug_address") ^ This is as expected: it's used by argp via the "argp_program_bug_address" name, which is not visible on the C level. Add __attribute__ ((used)) to make sure that the compiler emits it. While at it, fix debuginfod not printing the bug report address. Signed-off-by: Ilya Leoshkevich --- lib/printversion.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/printversion.h b/lib/printversion.h index a9e059ff..37adff7e 100644 --- a/lib/printversion.h +++ b/lib/printversion.h @@ -39,11 +39,14 @@ void print_version (FILE *stream, struct argp_state *state); argp_program_bug_address, in all programs. argp.h declares these variables as non-const (which is correct in general). But we can do better, it is not going to change. So we want to move them into - the .rodata section. Define macros to do the trick. */ + the .rodata section. Define macros to do the trick. The default + linkage for consts in C++ is internal, so declare them extern. */ #define ARGP_PROGRAM_VERSION_HOOK_DEF \ void (*const apvh) (FILE *, struct argp_state *) \ __asm ("argp_program_version_hook") #define ARGP_PROGRAM_BUG_ADDRESS_DEF \ - const char *const apba__ __asm ("argp_program_bug_address") + extern const char *const apba__; \ + const char *const apba__ __asm ("argp_program_bug_address") \ + __attribute__ ((used)) #endif // PRINTVERSION_H