From patchwork Mon May 23 14:07:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Florian Weimer X-Patchwork-Id: 54287 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 DA5E4383F94E for ; Mon, 23 May 2022 14:07:53 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DA5E4383F94E DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1653314873; bh=T7laL1WYGcqAS7VGs2HBY3R6TLv+hK4gBNuhp7My738=; h=To:Subject:In-Reply-To:References:Date:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To: From; b=f6Mwejo4AzgHBcL0I4gNs1fE9iY4zgm73zLorzQkkigYSl8czqadCXoQz3Fo2cPog UN7Ektjo2UNj/z41q1ruV9g4KToPKdUoWAbuUDdMLW95/2uGmwNyjQ7hlqS8JuXF8a zzQpxCvsLUqWkLaB7d4wiq/pBl0EtB3d7C1O42vU= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id 42BA1383F954 for ; Mon, 23 May 2022 14:07:10 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 42BA1383F954 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-461-srj3zKSkOxOkD14_Dwvq5g-1; Mon, 23 May 2022 10:07:08 -0400 X-MC-Unique: srj3zKSkOxOkD14_Dwvq5g-1 Received: from smtp.corp.redhat.com (int-mx09.intmail.prod.int.rdu2.redhat.com [10.11.54.9]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 84BC585A5BE for ; Mon, 23 May 2022 14:07:08 +0000 (UTC) Received: from oldenburg.str.redhat.com (unknown [10.39.192.91]) by smtp.corp.redhat.com (Postfix) with ESMTPS id EA338492C3B for ; Mon, 23 May 2022 14:07:07 +0000 (UTC) To: libc-alpha@sourceware.org Subject: [PATCH v2 01/14] stdio-common: Add printf specifier registry to In-Reply-To: References: X-From-Line: c50db9c524551c9cbe0b5b962833caa91fe85af9 Mon Sep 17 00:00:00 2001 Message-Id: Date: Mon, 23 May 2022 16:07:06 +0200 User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.2 (gnu/linux) MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.85 on 10.11.54.9 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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: libc-alpha@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Libc-alpha mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Florian Weimer via Libc-alpha From: Florian Weimer Reply-To: Florian Weimer Errors-To: libc-alpha-bounces+patchwork=sourceware.org@sourceware.org Sender: "Libc-alpha" Add __printf_arginfo_table, __printf_function_table, __printf_va_arg_table, __register_printf_specifier to include/printf.h. --- v2: More identifiers moved, and stdio-common/printf-parse.h updated. include/printf.h | 8 ++++++++ stdio-common/printf-parse.h | 6 ------ stdio-common/printf-prs.c | 1 + stdio-common/reg-printf.c | 7 ------- stdio-common/vfprintf-internal.c | 1 - 5 files changed, 9 insertions(+), 14 deletions(-) diff --git a/include/printf.h b/include/printf.h index 0ed6e87387..fb0b71fa4c 100644 --- a/include/printf.h +++ b/include/printf.h @@ -12,6 +12,14 @@ # ifndef _ISOMAC +/* Internal interfaces for registered specifiers. */ +extern printf_arginfo_size_function **__printf_arginfo_table attribute_hidden; +extern printf_function **__printf_function_table attribute_hidden; +extern printf_va_arg_function **__printf_va_arg_table attribute_hidden; +int __register_printf_specifier (int, printf_function, + printf_arginfo_size_function); +libc_hidden_proto (__register_printf_specifier) + #include /* Now define the internal interfaces. */ diff --git a/stdio-common/printf-parse.h b/stdio-common/printf-parse.h index de0f289c1f..362cce1ead 100644 --- a/stdio-common/printf-parse.h +++ b/stdio-common/printf-parse.h @@ -97,12 +97,6 @@ read_int (const UCHAR_T * *pstr) #endif -/* These are defined in reg-printf.c. */ -extern printf_arginfo_size_function **__printf_arginfo_table attribute_hidden; -extern printf_function **__printf_function_table attribute_hidden; -extern printf_va_arg_function **__printf_va_arg_table attribute_hidden; - - /* Find the next spec in FORMAT, or the end of the string. Returns a pointer into FORMAT, to a '%' or a '\0'. */ __extern_always_inline const unsigned char * diff --git a/stdio-common/printf-prs.c b/stdio-common/printf-prs.c index 55d1c471d7..f2fb9182b8 100644 --- a/stdio-common/printf-prs.c +++ b/stdio-common/printf-prs.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "../locale/localeinfo.h" diff --git a/stdio-common/reg-printf.c b/stdio-common/reg-printf.c index 400b99d2f6..5f4c6a24c2 100644 --- a/stdio-common/reg-printf.c +++ b/stdio-common/reg-printf.c @@ -30,13 +30,6 @@ printf_function **__printf_function_table attribute_hidden; __libc_lock_define_initialized (static, lock) -int __register_printf_specifier (int, printf_function, - printf_arginfo_size_function); -libc_hidden_proto (__register_printf_specifier) -int __register_printf_function (int, printf_function, - printf_arginfo_function); - - /* Register FUNC to be called to format SPEC specifiers. */ int __register_printf_specifier (int spec, printf_function converter, diff --git a/stdio-common/vfprintf-internal.c b/stdio-common/vfprintf-internal.c index 1986c4bdb5..f8aa2fdafb 100644 --- a/stdio-common/vfprintf-internal.c +++ b/stdio-common/vfprintf-internal.c @@ -1379,7 +1379,6 @@ printf_positional (FILE *s, const CHAR_T *format, int readonly_format, /* Process format specifiers. */ while (1) { - extern printf_function **__printf_function_table; int function_done; if (spec <= UCHAR_MAX