linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Erik Mouw <J.A.K.Mouw@its.tudelft.nl>
To: Linux kernel mailing list <linux-kernel@vger.kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>,
	Linus Torvalds <torvalds@transmeta.com>
Subject: [PATCH] add function attributes to sprintf() and snprintf()
Date: Wed, 7 Nov 2001 17:24:01 +0100	[thread overview]
Message-ID: <20011107172401.I14594@arthur.ubicom.tudelft.nl> (raw)

Hi,

This patch adds function attributes to sprintf() and snprintf() so the
compiler can catch formatting errors at compile time. Patch is against
2.4.13-ac8, but it should apply cleanly against 2.4.14 as well.


Erik

-- 
J.A.K. (Erik) Mouw, Information and Communication Theory Group, Faculty
of Information Technology and Systems, Delft University of Technology,
PO BOX 5031, 2600 GA Delft, The Netherlands  Phone: +31-15-2783635
Fax: +31-15-2781843  Email: J.A.K.Mouw@its.tudelft.nl
WWW: http://www-ict.its.tudelft.nl/~erik/


Index: include/linux/kernel.h
===================================================================
RCS file: /home/erik/cvsroot/elinux/include/linux/kernel.h,v
retrieving revision 1.1.1.143
diff -u -r1.1.1.143 kernel.h
--- linux/include/linux/kernel.h	2001/11/07 00:36:34	1.1.1.143
+++ linux/include/linux/kernel.h	2001/11/07 15:49:54
@@ -60,9 +60,11 @@
 extern long simple_strtol(const char *,char **,unsigned int);
 extern unsigned long long simple_strtoull(const char *,char **,unsigned int);
 extern long long simple_strtoll(const char *,char **,unsigned int);
-extern int sprintf(char * buf, const char * fmt, ...);
+extern int sprintf(char * buf, const char * fmt, ...)
+	__attribute__ ((format (printf, 2, 3)));
 extern int vsprintf(char *buf, const char *, va_list);
-extern int snprintf(char * buf, size_t size, const char *fmt, ...);
+extern int snprintf(char * buf, size_t size, const char * fmt, ...)
+	__attribute__ ((format (printf, 3, 4)));
 extern int vsnprintf(char *buf, size_t size, const char *fmt, va_list args);
 
 extern int sscanf(const char *, const char *, ...)

             reply	other threads:[~2001-11-07 16:24 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-11-07 16:24 Erik Mouw [this message]
2001-11-09  5:24 ` [PATCH] add function attributes to sprintf() and snprintf() James Antill

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=20011107172401.I14594@arthur.ubicom.tudelft.nl \
    --to=j.a.k.mouw@its.tudelft.nl \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@transmeta.com \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).