From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) by sourceware.org (Postfix) with ESMTPS id E396F3857365 for ; Mon, 13 Feb 2023 16:46:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org E396F3857365 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=linux.ibm.com Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 31DFh0TP028373; Mon, 13 Feb 2023 16:46:00 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ibm.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=pp1; bh=HMTnA7HvEYD+fMxJoI6gYVFxFBOic5hOuKk55IyMui8=; b=BykggCLw3Qs5X/0emlVGEzQpRdzdSAzikGo6cloliRPXVzA5evDj9PoC9X/eHh83XS+S V/pQanK08yNWP7wZDVmv4kozxb8JaHvybJvcKpfRd/3jBSjt8dnNX2jVzfcpKQROyawr 8M/XIAOvv58tTjPr4xjt3oCTJy3DMmIIg3Mpm9G182aZ/pupD9fJP/CqWGoYqSmHNrcS 57waoCInzWnjL4WMwq6zaFvC0ggdedb5K7zRZu+WFRisbppJVFZvTVDKI6zuiZLaCGCp l9lEdezHRZjIIaefWSTmcvpnjuK+xDXacnkhMNVfXyojwPUR1u32+a04bqGNRWKGDAIm pw== Received: from pps.reinject (localhost [127.0.0.1]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nqr36t1ag-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 16:46:00 +0000 Received: from m0098409.ppops.net (m0098409.ppops.net [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 31DGNouv019286; Mon, 13 Feb 2023 16:45:59 GMT Received: from ppma04fra.de.ibm.com (6a.4a.5195.ip4.static.sl-reverse.com [149.81.74.106]) by mx0a-001b2d01.pphosted.com (PPS) with ESMTPS id 3nqr36t19g-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 16:45:59 +0000 Received: from pps.filterd (ppma04fra.de.ibm.com [127.0.0.1]) by ppma04fra.de.ibm.com (8.17.1.19/8.17.1.19) with ESMTP id 31D4NpA8022562; Mon, 13 Feb 2023 16:45:57 GMT Received: from smtprelay04.fra02v.mail.ibm.com ([9.218.2.228]) by ppma04fra.de.ibm.com (PPS) with ESMTPS id 3np2n6a5xp-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 13 Feb 2023 16:45:57 +0000 Received: from smtpav05.fra02v.mail.ibm.com (smtpav05.fra02v.mail.ibm.com [10.20.54.104]) by smtprelay04.fra02v.mail.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id 31DGjsCk19005784 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Mon, 13 Feb 2023 16:45:54 GMT Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id B4F0320043; Mon, 13 Feb 2023 16:45:54 +0000 (GMT) Received: from smtpav05.fra02v.mail.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6D3DA20040; Mon, 13 Feb 2023 16:45:54 +0000 (GMT) Received: from heavy.ibmuc.com (unknown [9.171.19.58]) by smtpav05.fra02v.mail.ibm.com (Postfix) with ESMTP; Mon, 13 Feb 2023 16:45:54 +0000 (GMT) From: Ilya Leoshkevich To: Mark Wielaard , "Frank Ch . Eigler" Cc: elfutils-devel@sourceware.org, Ilya Leoshkevich Subject: [PATCH v3 2/4] printversion: Fix unused variable Date: Mon, 13 Feb 2023 17:45:49 +0100 Message-Id: <20230213164551.550400-3-iii@linux.ibm.com> X-Mailer: git-send-email 2.39.1 In-Reply-To: <20230213164551.550400-1-iii@linux.ibm.com> References: <20230213164551.550400-1-iii@linux.ibm.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-TM-AS-GCONF: 00 X-Proofpoint-GUID: xzW7xRv3IYbOXTG3SUJ3ZAEP_OenMhgQ X-Proofpoint-ORIG-GUID: RJMXzQ7SEmt5qg4ekkKu5bbEMXSsXP2A X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.219,Aquarius:18.0.930,Hydra:6.0.562,FMLib:17.11.170.22 definitions=2023-02-13_11,2023-02-13_01,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 clxscore=1015 mlxlogscore=999 bulkscore=0 spamscore=0 suspectscore=0 mlxscore=0 phishscore=0 adultscore=0 impostorscore=0 malwarescore=0 lowpriorityscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2302130150 X-Spam-Status: No, score=-11.6 required=5.0 tests=BAYES_00,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,GIT_PATCH_0,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: 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") ^ The default linkage for consts in C++ is internal, so declare them extern. While at it, remove the debuginfod workaround for argp_program_version_hook. Co-developed-by: Mark Wielaard Signed-off-by: Ilya Leoshkevich --- debuginfod/debuginfod.cxx | 3 +-- lib/printversion.h | 5 ++++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/debuginfod/debuginfod.cxx b/debuginfod/debuginfod.cxx index 4271acf4..99b1f2b9 100644 --- a/debuginfod/debuginfod.cxx +++ b/debuginfod/debuginfod.cxx @@ -348,7 +348,7 @@ static const char DEBUGINFOD_SQLITE_CLEANUP_DDL[] = /* Name and version of program. */ -/* ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; */ // not this simple for C++ +ARGP_PROGRAM_VERSION_HOOK_DEF = print_version; /* Bug report address. */ ARGP_PROGRAM_BUG_ADDRESS_DEF = PACKAGE_BUGREPORT; @@ -4171,7 +4171,6 @@ main (int argc, char *argv[]) /* Parse and process arguments. */ int remaining; - argp_program_version_hook = print_version; // this works (void) argp_parse (&argp, argc, argv, ARGP_IN_ORDER, &remaining, NULL); if (remaining != argc) error (EXIT_FAILURE, 0, diff --git a/lib/printversion.h b/lib/printversion.h index a9e059ff..4154b328 100644 --- a/lib/printversion.h +++ b/lib/printversion.h @@ -39,10 +39,13 @@ 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. */ +extern void (*const apvh) (FILE *, struct argp_state *); #define ARGP_PROGRAM_VERSION_HOOK_DEF \ void (*const apvh) (FILE *, struct argp_state *) \ __asm ("argp_program_version_hook") +extern const char *const apba__; #define ARGP_PROGRAM_BUG_ADDRESS_DEF \ const char *const apba__ __asm ("argp_program_bug_address") -- 2.39.1