From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8776 invoked by alias); 26 Feb 2015 02:31:18 -0000 Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org Received: (qmail 8766 invoked by uid 89); 26 Feb 2015 02:31:17 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.1 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ig0-f171.google.com Received: from mail-ig0-f171.google.com (HELO mail-ig0-f171.google.com) (209.85.213.171) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Thu, 26 Feb 2015 02:31:16 +0000 Received: by mail-ig0-f171.google.com with SMTP id h15so40885662igd.4 for ; Wed, 25 Feb 2015 18:31:14 -0800 (PST) X-Received: by 10.107.10.74 with SMTP id u71mr9079367ioi.0.1424917874325; Wed, 25 Feb 2015 18:31:14 -0800 (PST) MIME-Version: 1.0 Received: by 10.42.161.131 with HTTP; Wed, 25 Feb 2015 18:30:44 -0800 (PST) In-Reply-To: <225BDA7A-3A1F-4F94-8086-E44249E273D5@gmail.com> References: <0AB56024-875B-4724-8ED2-A9DDB237CBFF@dell.com> <23CC7871-C616-436C-920C-4A635DC87189@dell.com> <7A311B56-C424-4C4F-A0E4-B12B65131745@gmail.com> <225BDA7A-3A1F-4F94-8086-E44249E273D5@gmail.com> From: Simon Marchi Date: Thu, 26 Feb 2015 02:38:00 -0000 Message-ID: Subject: Re: format string is not a string literal To: pinskia@gmail.com Cc: Jack Howarth , "Paul_Koning@dell.com" , "gdb@sourceware.org" Content-Type: text/plain; charset=UTF-8 X-IsSubscribed: yes X-SW-Source: 2015-02/txt/msg00060.txt.bz2 >> On Feb 25, 2015, at 4:41 PM, Jack Howarth wrote: >> >> Andrew, >> See the additional comments from the llvm.org clang developers at... >> >> http://llvm.org/bugs/show_bug.cgi?id=22701#c5 > > Then put this warning under a different flag. Anyways clang is broken and gdb should not change due to a broken compiler. > > Thanks, > Andrew I would not say that clang is broken or that the warning is unclear. The flag is -Wformat-nonliteral and the warning message is "format string is not a string literal". I don't know how you can be more clear and direct about the fact that the format string is not a string literal. Looking at the code, we observe that clang is right (the format string is indeed not a string literal). With the proper function attributes, the compiler could do better checks and prevent programming mistakes. Since clang pointed out this low-hanging fruit improvement to gdb's code, why shouldn't we take advantage of it? Anyway, Jack, you are welcome to submit a patch for this if you feel like it and/or file a bug if it is not already done. Simon