From patchwork Fri Mar 5 23:51:05 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alejandro Colomar X-Patchwork-Id: 42357 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 BD122399C037; Fri, 5 Mar 2021 23:51:37 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org BD122399C037 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1614988297; bh=HhvuXCSbRnCi7UkA1cJpWv2boJvtS+wypg1tiYOyje8=; h=To:Subject:Date:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=DG4g2uSUqL2w49mxXu/m2n3HI7gNF4pGBzznpiZueXqf+5wjI83UObfnF543t5H+X yXh83y6SHjf/QMhjacti8vmKvcVGEH9+c3/PNzUdaVw+vvmAneMOnKiM3a7hdr5pGj 87+9pbumacphNca+YC3LqhIm1ULtfFK8AFa7sOC8= X-Original-To: libc-alpha@sourceware.org Delivered-To: libc-alpha@sourceware.org Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) by sourceware.org (Postfix) with ESMTPS id 78865399F00F for ; Fri, 5 Mar 2021 23:51:33 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 78865399F00F Received: by mail-wm1-x330.google.com with SMTP id d139-20020a1c1d910000b029010b895cb6f2so243854wmd.5 for ; Fri, 05 Mar 2021 15:51:33 -0800 (PST) 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=HhvuXCSbRnCi7UkA1cJpWv2boJvtS+wypg1tiYOyje8=; b=jR9gWKdKlLiyzrk4JGp6wg+BMTAdVJk3E+oDX4B0Pm39QtMehNXaxH6Tl3LSMCkZFQ dy/sXfOJcDZdhrSpN+crE7xqNQpEmgAF8zgVnBQoWTIfA3c+SDNZ5eGn9F5X1bmQUoO4 QFrBM6IK0wW6wNbsJHAjaTHmxzcCX4bhTIJcghtfBJU1DDog/u0B1Aa3wLax9UDzvnwr 53pXCu1QBqYLhiXjglxb2ptVupInnImiKqxzYL7D06PiU3Ua9mK8OIQyyAWSDL6u9j2F X23nHsD019aH8xCLQHYNcg+L/UvKNO3Sg5PE2LImMItO10Lf0JWxQGgMZni+XMjHK4eX PNlQ== X-Gm-Message-State: AOAM532uochJoVGPvLEbvWOQty4rL4sbwLoS5sO7yohQjyHbqhjJy20Q miKAuOTpo3YcWG9+/Ys+bNlDEejeIfgNDw== X-Google-Smtp-Source: ABdhPJyI8SAW6g80glEEoplZMLFES4asrKDGXzsQrrBUUHzQDaHaAQ1/3RLCLvohHzUd7tpy3Lg5Ew== X-Received: by 2002:a1c:a504:: with SMTP id o4mr10949087wme.174.1614988292707; Fri, 05 Mar 2021 15:51:32 -0800 (PST) Received: from localhost.localdomain ([170.253.51.130]) by smtp.googlemail.com with ESMTPSA id f7sm7219835wrm.36.2021.03.05.15.51.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 05 Mar 2021 15:51:32 -0800 (PST) To: mtk.manpages@gmail.com Subject: [PATCH 21/22] printf.3: SYNOPSIS: Use 'restrict' in prototypes; ffix too Date: Sat, 6 Mar 2021 00:51:05 +0100 Message-Id: <20210305235105.177359-22-alx.manpages@gmail.com> X-Mailer: git-send-email 2.30.1.721.g45526154a5 In-Reply-To: <20210305235105.177359-1-alx.manpages@gmail.com> References: <20210305235105.177359-1-alx.manpages@gmail.com> MIME-Version: 1.0 X-Spam-Status: No, score=-12.3 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, GIT_PATCH_0, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) 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: Alejandro Colomar via Libc-alpha From: Alejandro Colomar Reply-To: Alejandro Colomar Cc: Alejandro Colomar , linux-man@vger.kernel.org, libc-alpha@sourceware.org Errors-To: libc-alpha-bounces@sourceware.org Sender: "Libc-alpha" Both POSIX and glibc use 'restrict' in printf(), fprintf(), dprintf(), sprintf(), snprintf(), vprintf(), vfprintf(), vdprintf(), vsprintf(), vsnprintf(). Let's use it here too. .../glibc$ grep_glibc_prototype printf libio/stdio.h:332: extern int printf (const char *__restrict __format, ...); .../glibc$ grep_glibc_prototype fprintf libio/stdio.h:326: extern int fprintf (FILE *__restrict __stream, const char *__restrict __format, ...); .../glibc$ grep_glibc_prototype dprintf libio/stdio.h:382: extern int dprintf (int __fd, const char *__restrict __fmt, ...) __attribute__ ((__format__ (__printf__, 2, 3))); .../glibc$ grep_glibc_prototype sprintf libio/stdio.h:334: extern int sprintf (char *__restrict __s, const char *__restrict __format, ...) __THROWNL; .../glibc$ grep_glibc_prototype snprintf libio/stdio.h:354: extern int snprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, ...) __THROWNL __attribute__ ((__format__ (__printf__, 3, 4))); .../glibc$ grep_glibc_prototype vprintf libio/stdio.h:347: extern int vprintf (const char *__restrict __format, __gnuc_va_list __arg); .../glibc$ grep_glibc_prototype vfprintf libio/stdio.h:341: extern int vfprintf (FILE *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg); .../glibc$ grep_glibc_prototype vdprintf libio/stdio.h:379: extern int vdprintf (int __fd, const char *__restrict __fmt, __gnuc_va_list __arg) __attribute__ ((__format__ (__printf__, 2, 0))); .../glibc$ grep_glibc_prototype vsprintf libio/stdio.h:349: extern int vsprintf (char *__restrict __s, const char *__restrict __format, __gnuc_va_list __arg) __THROWNL; .../glibc$ grep_glibc_prototype vsnprintf libio/stdio.h:358: extern int vsnprintf (char *__restrict __s, size_t __maxlen, const char *__restrict __format, __gnuc_va_list __arg) __THROWNL __attribute__ ((__format__ (__printf__, 3, 0))); .../glibc$ ffix: Align common parameters. Signed-off-by: Alejandro Colomar --- man3/printf.3 | 29 ++++++++++++++++++----------- 1 file changed, 18 insertions(+), 11 deletions(-) diff --git a/man3/printf.3 b/man3/printf.3 index 48bb9771d..fa6564426 100644 --- a/man3/printf.3 +++ b/man3/printf.3 @@ -39,20 +39,27 @@ vsprintf, vsnprintf \- formatted output conversion .nf .B #include .PP -.BI "int printf(const char *" format ", ...);" -.BI "int fprintf(FILE *" stream ", const char *" format ", ...);" -.BI "int dprintf(int " fd ", const char *" format ", ...);" -.BI "int sprintf(char *" str ", const char *" format ", ...);" -.BI "int snprintf(char *" str ", size_t " size ", const char *" format ", ...);" +.BI "int printf(const char *restrict " format ", ...);" +.BI "int fprintf(FILE *restrict " stream , +.BI " const char *restrict " format ", ...);" +.BI "int dprintf(int " fd , +.BI " const char *restrict " format ", ...);" +.BI "int sprintf(char *restrict " str , +.BI " const char *restrict " format ", ...);" +.BI "int snprintf(char *restrict " str ", size_t " size , +.BI " const char *restrict " format ", ...);" .PP .B #include .PP -.BI "int vprintf(const char *" format ", va_list " ap ); -.BI "int vfprintf(FILE *" stream ", const char *" format ", va_list " ap ); -.BI "int vdprintf(int " fd ", const char *" format ", va_list " ap ); -.BI "int vsprintf(char *" str ", const char *" format ", va_list " ap ); -.BI "int vsnprintf(char *" str ", size_t " size ", const char *" format \ -", va_list " ap ); +.BI "int vprintf(const char *restrict " format ", va_list " ap ); +.BI "int vfprintf(FILE *restrict " stream , +.BI " const char *restrict " format ", va_list " ap ); +.BI "int vdprintf(int " fd , +.BI " const char *restrict " format ", va_list " ap ); +.BI "int vsprintf(char *restrict " str , +.BI " const char *restrict " format ", va_list " ap ); +.BI "int vsnprintf(char *restrict " str ", size_t " size , +.BI " const char *restrict " format ", va_list " ap ); .fi .PP .RS -4