From patchwork Fri May 25 03:15:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Joel Stanley X-Patchwork-Id: 920203 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40sX9F0xFyz9s15 for ; Fri, 25 May 2018 13:41:21 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lp1LswK/"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 40sX9D6F1YzDqGD for ; Fri, 25 May 2018 13:41:20 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lp1LswK/"; dkim-atps=neutral X-Original-To: pdbg@lists.ozlabs.org Delivered-To: pdbg@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gmail.com (client-ip=2607:f8b0:400e:c00::242; helo=mail-pf0-x242.google.com; envelope-from=joel.stan@gmail.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=jms.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b="lp1LswK/"; dkim-atps=neutral Received: from mail-pf0-x242.google.com (mail-pf0-x242.google.com [IPv6:2607:f8b0:400e:c00::242]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 40sWbd0q69zF1dS for ; Fri, 25 May 2018 13:15:40 +1000 (AEST) Received: by mail-pf0-x242.google.com with SMTP id v63-v6so1856613pfk.8 for ; Thu, 24 May 2018 20:15:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:subject:date:message-id; bh=M0HWCn6MK2hHT+ap62LlVNaLv/jQbYPQiSrka3xZkig=; b=lp1LswK/43f9wT4UD9ydBkquc/0R8floeKxWZWQTJCxkve7nlyoAbpC675HVzT19xa IDueF+X26q6/O4myN8UtEdnZT9Ozr/qRWEndJh9GeQtWr95a3IR+qZrAUcmAl0Gumegl C6d6/bsoz2JjJoEyV+nge4aUpQC94AzWa4neSe02VynCLM59UqitLlQtDIzr9mfKNWQ3 z34aPRjCO7a4yxXSe27KH9DzEfSPmQIV6hL/PK0kUZBbjh1JYw1i/Io/q4o796CF+9mX RkmHzkWLz2b8WOj6Zh/GkKtRwaeaymEmu36Kfacp2eOXch4nRCvVTW6LDC6tRJZrRhyV BxLQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:subject:date:message-id; bh=M0HWCn6MK2hHT+ap62LlVNaLv/jQbYPQiSrka3xZkig=; b=keQqBuv5nOOxsU6DZBvGqvd5C5qLMMn7fIuwLYY9Lv0FOyizoDJ4Bgh5Eey4E98+u4 YJVXxENW746XX8wsKlFhoa5fsxudWhT0ANsEPeTF+GzuZw6qw4n1cTkBgdB33YFe/Ajt BbOBkWSdFZBWaxVME63uUVaYEp5+QRxgWVl1o1FTlaC07XpI4nOb77dKDXkMinSZkEE5 +SbQJNGMdWiPSFlxvm+4X04f/fEEMvBqn107LLjFG8+dZP9J5dlsYGHhp8qgIJ9yWGqs IM1fF5K/IT6Tw8Y7qJz+f6FqXSwQ8zniU33upgbMk3HecsQDKUOteeBWWkHU87wKjle7 4BtA== X-Gm-Message-State: ALKqPwfsTnpZo3o/MzzJZgxk5N+obWKhYukaqjZFE7FWn2nu1+NSlx54 w2lopkHk/PVoddSAGKaBI4S6SYrh X-Google-Smtp-Source: AB8JxZrikO9l6UH8051WRYgD8hwNp5Ir1DODsyUN6eQ7+Aln0pXmc5I9N4vlmQQkgm2Go8fKqIhA2w== X-Received: by 2002:a65:6496:: with SMTP id e22-v6mr549446pgv.386.1527218138625; Thu, 24 May 2018 20:15:38 -0700 (PDT) Received: from aurora.jms.id.au ([45.124.203.19]) by smtp.gmail.com with ESMTPSA id z4-v6sm617561pfm.28.2018.05.24.20.15.35 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Thu, 24 May 2018 20:15:37 -0700 (PDT) Received: by aurora.jms.id.au (sSMTP sendmail emulation); Fri, 25 May 2018 12:45:33 +0930 From: Joel Stanley To: pdbg@lists.ozlabs.org Date: Fri, 25 May 2018 12:45:31 +0930 Message-Id: <20180525031531.22785-1-joel@jms.id.au> X-Mailer: git-send-email 2.17.0 Subject: [Pdbg] [PATCH] debug: Add printf attribute to logging function X-BeenThere: pdbg@lists.ozlabs.org X-Mailman-Version: 2.1.26 Precedence: list List-Id: "mailing list for https://github.com/open-power/pdbg development" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: pdbg-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Pdbg" This allows the compiler to warn about mismatched types in printf arguments. Without this we don't get warnings from the logging macros when format specifiers and arguments don't match up, and instead you get segfaults. Signed-off-by: Joel Stanley --- libpdbg/debug.h | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libpdbg/debug.h b/libpdbg/debug.h index c318e3a566e6..5fc027a64ead 100644 --- a/libpdbg/debug.h +++ b/libpdbg/debug.h @@ -18,6 +18,8 @@ #include "libpdbg.h" +void pdbg_log(int log_level, const char* fmt, ...) __attribute__((format (printf, 2, 3))); + #define PR_ERROR(x, args...) \ pdbg_log(PDBG_ERROR, x, ##args) #define PR_WARNING(x, args...) \