All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jiri Kosina <trivial@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org
Subject: Re: [PATCH] treewide: Use __printf not __attribute__((format(printf,...)))
Date: Tue, 11 Oct 2011 20:22:08 +0300	[thread overview]
Message-ID: <20111011172208.GA3633@shutemov.name> (raw)
In-Reply-To: <1314327338.19476.30.camel@Joe-Laptop>

On Thu, Aug 25, 2011 at 07:55:37PM -0700, Joe Perches wrote:
> Standardize the style for compiler based printf format verification.
> Standardized the location of __printf too.
> 
> Done via script and a little typing.
> 
> $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
>   grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
>   xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
> 
> Completely untested...

This patch breaks ARCH=um (linux-next-20111011):

In file included from /home/kas/git/public/linux-next/arch/um/os-Linux/aio.c:17:0:
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:26:17: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:26:20: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:29:17: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:29:20: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/os-Linux/aio.c: In function ‘do_aio’:
/home/kas/git/public/linux-next/arch/um/os-Linux/aio.c:93:3: error: implicit declaration of function ‘printk’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

> 
> Signed-off-by: Joe Perches <joe@perches.com>
> 
> ---
> 
> On Thu, 2011-08-25 at 18:07 -0700, Andrew Morton wrote:
> > On Thu, 25 Aug 2011 17:38:08 -0700 Joe Perches <joe@perches.com> wrote:
> > > So if you really like it that much:
> > Well I don't particularly like it, personally.  But they're there, so
> > we either fully use them or fully unuse them, then remove them.
>  
> I don't mind one way or another, and I do
> like consistency, so I guess the __printf
> form is a bit better match to the other
> __attribute__ #defines.
> 
> I just don't have any particular desire
> to push it to anyone though.
> 
> Here it is, totally untested.

<skip/>

> diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
> index 293f7c7..e253af9 100644
> --- a/arch/um/include/shared/user.h
> +++ b/arch/um/include/shared/user.h
> @@ -23,14 +23,12 @@
>  #include <stddef.h>
>  #endif
>  
> -extern void panic(const char *fmt, ...)
> -	__attribute__ ((format (printf, 1, 2)));
> +extern __printf(1, 2) void panic(const char *fmt, ...);
>  
>  #ifdef UML_CONFIG_PRINTK
> -extern int printk(const char *fmt, ...)
> -	__attribute__ ((format (printf, 1, 2)));
> +extern __printf(1, 2) int printk(const char *fmt, ...);
>  #else
> -static inline int printk(const char *fmt, ...)
> +static inline __printf(1, 2) int printk(const char *fmt, ...)
>  {
>  	return 0;
>  }

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jiri Kosina <trivial@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org
Subject: Re: [PATCH] treewide: Use __printf not __attribute__((format(printf,...)))
Date: Tue, 11 Oct 2011 20:22:08 +0300	[thread overview]
Message-ID: <20111011172208.GA3633@shutemov.name> (raw)
In-Reply-To: <1314327338.19476.30.camel@Joe-Laptop>

On Thu, Aug 25, 2011 at 07:55:37PM -0700, Joe Perches wrote:
> Standardize the style for compiler based printf format verification.
> Standardized the location of __printf too.
> 
> Done via script and a little typing.
> 
> $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
>   grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
>   xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
> 
> Completely untested...

This patch breaks ARCH=um (linux-next-20111011):

In file included from /home/kas/git/public/linux-next/arch/um/os-Linux/aio.c:17:0:
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:26:17: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:26:20: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:29:17: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:29:20: error: expected declaration specifiers or ‘...’ before numeric constant
/home/kas/git/public/linux-next/arch/um/os-Linux/aio.c: In function ‘do_aio’:
/home/kas/git/public/linux-next/arch/um/os-Linux/aio.c:93:3: error: implicit declaration of function ‘printk’ [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

> 
> Signed-off-by: Joe Perches <joe@perches.com>
> 
> ---
> 
> On Thu, 2011-08-25 at 18:07 -0700, Andrew Morton wrote:
> > On Thu, 25 Aug 2011 17:38:08 -0700 Joe Perches <joe@perches.com> wrote:
> > > So if you really like it that much:
> > Well I don't particularly like it, personally.  But they're there, so
> > we either fully use them or fully unuse them, then remove them.
>  
> I don't mind one way or another, and I do
> like consistency, so I guess the __printf
> form is a bit better match to the other
> __attribute__ #defines.
> 
> I just don't have any particular desire
> to push it to anyone though.
> 
> Here it is, totally untested.

<skip/>

> diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
> index 293f7c7..e253af9 100644
> --- a/arch/um/include/shared/user.h
> +++ b/arch/um/include/shared/user.h
> @@ -23,14 +23,12 @@
>  #include <stddef.h>
>  #endif
>  
> -extern void panic(const char *fmt, ...)
> -	__attribute__ ((format (printf, 1, 2)));
> +extern __printf(1, 2) void panic(const char *fmt, ...);
>  
>  #ifdef UML_CONFIG_PRINTK
> -extern int printk(const char *fmt, ...)
> -	__attribute__ ((format (printf, 1, 2)));
> +extern __printf(1, 2) int printk(const char *fmt, ...);
>  #else
> -static inline int printk(const char *fmt, ...)
> +static inline __printf(1, 2) int printk(const char *fmt, ...)
>  {
>  	return 0;
>  }

-- 
 Kirill A. Shutemov

WARNING: multiple messages have this Message-ID (diff)
From: "Kirill A. Shutemov" <kirill@shutemov.name>
To: Joe Perches <joe@perches.com>
Cc: Andrew Morton <akpm@linux-foundation.org>,
	Jiri Kosina <trivial@kernel.org>,
	linux-kernel@vger.kernel.org, linux-mm@kvack.org,
	Stephen Rothwell <sfr@canb.auug.org.au>,
	linux-next@vger.kernel.org
Subject: Re: [PATCH] treewide: Use __printf not __attribute__((format(printf,...)))
Date: Tue, 11 Oct 2011 20:22:08 +0300	[thread overview]
Message-ID: <20111011172208.GA3633@shutemov.name> (raw)
In-Reply-To: <1314327338.19476.30.camel@Joe-Laptop>

On Thu, Aug 25, 2011 at 07:55:37PM -0700, Joe Perches wrote:
> Standardize the style for compiler based printf format verification.
> Standardized the location of __printf too.
> 
> Done via script and a little typing.
> 
> $ grep -rPl --include=*.[ch] -w "__attribute__" * | \
>   grep -vP "^(tools|scripts|include/linux/compiler-gcc.h)" | \
>   xargs perl -n -i -e 'local $/; while (<>) { s/\b__attribute__\s*\(\s*\(\s*format\s*\(\s*printf\s*,\s*(.+)\s*,\s*(.+)\s*\)\s*\)\s*\)/__printf($1, $2)/g ; print; }'
> 
> Completely untested...

This patch breaks ARCH=um (linux-next-20111011):

In file included from /home/kas/git/public/linux-next/arch/um/os-Linux/aio.c:17:0:
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:26:17: error: expected declaration specifiers or a??...a?? before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:26:20: error: expected declaration specifiers or a??...a?? before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:29:17: error: expected declaration specifiers or a??...a?? before numeric constant
/home/kas/git/public/linux-next/arch/um/include/shared/user.h:29:20: error: expected declaration specifiers or a??...a?? before numeric constant
/home/kas/git/public/linux-next/arch/um/os-Linux/aio.c: In function a??do_aioa??:
/home/kas/git/public/linux-next/arch/um/os-Linux/aio.c:93:3: error: implicit declaration of function a??printka?? [-Werror=implicit-function-declaration]
cc1: some warnings being treated as errors

> 
> Signed-off-by: Joe Perches <joe@perches.com>
> 
> ---
> 
> On Thu, 2011-08-25 at 18:07 -0700, Andrew Morton wrote:
> > On Thu, 25 Aug 2011 17:38:08 -0700 Joe Perches <joe@perches.com> wrote:
> > > So if you really like it that much:
> > Well I don't particularly like it, personally.  But they're there, so
> > we either fully use them or fully unuse them, then remove them.
>  
> I don't mind one way or another, and I do
> like consistency, so I guess the __printf
> form is a bit better match to the other
> __attribute__ #defines.
> 
> I just don't have any particular desire
> to push it to anyone though.
> 
> Here it is, totally untested.

<skip/>

> diff --git a/arch/um/include/shared/user.h b/arch/um/include/shared/user.h
> index 293f7c7..e253af9 100644
> --- a/arch/um/include/shared/user.h
> +++ b/arch/um/include/shared/user.h
> @@ -23,14 +23,12 @@
>  #include <stddef.h>
>  #endif
>  
> -extern void panic(const char *fmt, ...)
> -	__attribute__ ((format (printf, 1, 2)));
> +extern __printf(1, 2) void panic(const char *fmt, ...);
>  
>  #ifdef UML_CONFIG_PRINTK
> -extern int printk(const char *fmt, ...)
> -	__attribute__ ((format (printf, 1, 2)));
> +extern __printf(1, 2) int printk(const char *fmt, ...);
>  #else
> -static inline int printk(const char *fmt, ...)
> +static inline __printf(1, 2) int printk(const char *fmt, ...)
>  {
>  	return 0;
>  }

-- 
 Kirill A. Shutemov

--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org.  For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom internet charges in Canada: sign http://stopthemeter.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>

  reply	other threads:[~2011-10-11 17:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-25 20:26 [PATCH] mm: Neaten warn_alloc_failed Joe Perches
2011-08-25 20:26 ` Joe Perches
2011-08-25 23:50 ` Andrew Morton
2011-08-25 23:50   ` Andrew Morton
2011-08-26  0:00   ` Joe Perches
2011-08-26  0:00     ` Joe Perches
2011-08-26  0:05     ` Andrew Morton
2011-08-26  0:05       ` Andrew Morton
2011-08-26  0:38       ` Joe Perches
2011-08-26  0:38         ` Joe Perches
2011-08-26  1:07         ` Andrew Morton
2011-08-26  1:07           ` Andrew Morton
2011-08-26  2:55           ` [PATCH] treewide: Use __printf not __attribute__((format(printf,...))) Joe Perches
2011-08-26  2:55             ` Joe Perches
2011-10-11 17:22             ` Kirill A. Shutemov [this message]
2011-10-11 17:22               ` Kirill A. Shutemov
2011-10-11 17:22               ` Kirill A. Shutemov
2011-10-11 17:43               ` Joe Perches
2011-10-11 17:43                 ` Joe Perches
     [not found]             ` <20111101150908.b482fad5.akpm@linux-foundation.org>
2011-11-02  2:27               ` [PATCH] checkpatch: Prefer " Joe Perches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111011172208.GA3633@shutemov.name \
    --to=kirill@shutemov.name \
    --cc=akpm@linux-foundation.org \
    --cc=joe@perches.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mm@kvack.org \
    --cc=linux-next@vger.kernel.org \
    --cc=sfr@canb.auug.org.au \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.