From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 94398 invoked by alias); 25 Sep 2017 14:14:06 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 93684 invoked by uid 89); 25 Sep 2017 14:14:05 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.9 required=5.0 tests=AWL,BAYES_00,KAM_LAZY_DOMAIN_SECURITY,RCVD_IN_DNSWL_NONE autolearn=no version=3.3.2 spammy=Blvd, nuances, inappropriate, Alto X-HELO: resqmta-po-09v.sys.comcast.net Received: from resqmta-po-09v.sys.comcast.net (HELO resqmta-po-09v.sys.comcast.net) (96.114.154.168) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 25 Sep 2017 14:14:04 +0000 Received: from resomta-po-13v.sys.comcast.net ([96.114.154.237]) by resqmta-po-09v.sys.comcast.net with ESMTP id wU8SdS7gI1CW1wU94d6aGe; Mon, 25 Sep 2017 14:14:02 +0000 Received: from vm-fedora21.eagercon.com ([76.21.114.27]) by resomta-po-13v.sys.comcast.net with SMTP id wU92dBriUBsPAwU93d0kU5; Mon, 25 Sep 2017 14:14:02 +0000 Subject: Re: [pushed] microblaze-tdep: Add ATTRIBUTE_PRINTF to microblaze_debug To: Simon Marchi , gdb-patches@sourceware.org References: <1505995878-10687-1-git-send-email-simon.marchi@ericsson.com> From: Michael Eager Message-ID: <078ea0b6-71aa-f74d-33fc-859322d4668a@eagerm.com> Date: Mon, 25 Sep 2017 14:14:00 -0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:52.0) Gecko/20100101 Thunderbird/52.3.0 MIME-Version: 1.0 In-Reply-To: <1505995878-10687-1-git-send-email-simon.marchi@ericsson.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-CMAE-Envelope: MS4wfOVay3nco4gM7Eng6JhgDj329nRClPg3nz35/8KftqdqdcjHjeGC351sp9CEYfveRvSX/jqo2tqHkVgGiHIJn4ezQYhTh4w4fPE6MUqXYsH31AtN+vJ0 X+9/0oz04mcfA7GTOxSLBzW6AxRmhscyxaYFGVhxjwGxcg9yk5fKYuufDROdv7ckfwlsIXWmGSkQMv/LlM55mQ2jTvipK2BfoVZYxAr2+dqolVB8tTykmIdF X-IsSubscribed: yes X-SW-Source: 2017-09/txt/msg00750.txt.bz2 On 09/21/2017 05:11 AM, Simon Marchi wrote: > I am getting this warning with clang: > > /home/emaisin/src/binutils-gdb/gdb/microblaze-tdep.c:94:28: error: format string is not a string literal [-Werror,-Wformat-nonliteral] > vprintf_unfiltered (fmt, args); > ^~~ > > Adding ATTRIBUTE_PRINTF to microblaze_debug gets rid of it. Strangely, > gcc doesn't warn about non-literal format strings when calling vprintf > (or a vprintf-style function, like vprintf_unfiltered). I filed this > gcc bug: > > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=82206 I'll admit to not being familiar with the nuances of __attribute__ ((format ...)), or why adding this to the function declaration of microblaze_debug() would suppress a diagnostic on the call to vprintf_unfiltered(), but the better fix seems to me to be to turn off the obviously inappropriate -Wformat-nonliteral option in microblaze_debug() using #pragma GCC diagnostic ignored "-Wformat-nonliteral" See https://stackoverflow.com/questions/12171132/avoid-warning-in-wrapper-around-printf -- Michael Eager eager@eagercon.com 1960 Park Blvd., Palo Alto, CA 94306 650-325-8077