From mboxrd@z Thu Jan 1 00:00:00 1970 X-Msuck: nntp://news.gmane.org/gmane.linux.lib.musl.general/9180 Path: news.gmane.org!not-for-mail From: Alexander Monakov Newsgroups: gmane.linux.lib.musl.general Subject: Re: [PATCH] Add format attribute to some function declarations Date: Sun, 24 Jan 2016 00:05:36 +0300 (MSK) Message-ID: References: <1453581976-10098-1-git-send-email-hauke@hauke-m.de> Reply-To: musl@lists.openwall.com NNTP-Posting-Host: plane.gmane.org Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Trace: ger.gmane.org 1453583151 26701 80.91.229.3 (23 Jan 2016 21:05:51 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Sat, 23 Jan 2016 21:05:51 +0000 (UTC) Cc: Hauke Mehrtens To: musl@lists.openwall.com Original-X-From: musl-return-9193-gllmg-musl=m.gmane.org@lists.openwall.com Sat Jan 23 22:05:50 2016 Return-path: Envelope-to: gllmg-musl@m.gmane.org Original-Received: from mother.openwall.net ([195.42.179.200]) by plane.gmane.org with smtp (Exim 4.69) (envelope-from ) id 1aN5NW-0004LQ-Mc for gllmg-musl@m.gmane.org; Sat, 23 Jan 2016 22:05:50 +0100 Original-Received: (qmail 28397 invoked by uid 550); 23 Jan 2016 21:05:48 -0000 Mailing-List: contact musl-help@lists.openwall.com; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-ID: Original-Received: (qmail 28375 invoked from network); 23 Jan 2016 21:05:48 -0000 In-Reply-To: <1453581976-10098-1-git-send-email-hauke@hauke-m.de> User-Agent: Alpine 2.20 (LNX 67 2015-01-07) Xref: news.gmane.org gmane.linux.lib.musl.general:9180 Archived-At: On Sat, 23 Jan 2016, Hauke Mehrtens wrote: > GCC and Clang are able to check the format arguments given to a > function and warn the user if there is a error in the format arguments > or if there is a potential uncontrolled format string security problem > in the code. GCC does this automatically for some functions like > printf(), but it is also possible to annotate other functions in a way > that it will check them too. This feature is used by glibc for many > functions. This patch adds the attribute to the some functions of musl > expect for these functions where gcc automatically adds it. Here's how a similar change was done the last time around: http://git.musl-libc.org/cgit/musl/commit/?id=ccc71e0ea881b7f6594ed95afd706442829c39fc Note that that approach avoids repeating #ifdef __GNUC__ ... How did you choose which functions from stdio.h to annotate? Are you saying that gcc is unaware of snprintf while it recognizes sprintf? Thanks. Alexander