From patchwork Fri Jul 12 11:03:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Colin Ian King X-Patchwork-Id: 258737 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) by ozlabs.org (Postfix) with ESMTP id C5D092C0300 for ; Fri, 12 Jul 2013 21:03:56 +1000 (EST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Uxb8l-0002Em-KJ; Fri, 12 Jul 2013 11:03:55 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtp (Exim 4.76) (envelope-from ) id 1Uxb8H-0002Be-5s for fwts-devel@lists.ubuntu.com; Fri, 12 Jul 2013 11:03:25 +0000 Received: from cpc3-craw6-2-0-cust180.croy.cable.virginmedia.com ([77.100.248.181] helo=localhost) by youngberry.canonical.com with esmtpsa (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1Uxb8H-0005Wt-1i for fwts-devel@lists.ubuntu.com; Fri, 12 Jul 2013 11:03:25 +0000 From: Colin King To: fwts-devel@lists.ubuntu.com Subject: [PATCH] acpi: syntaxcheck: ensure error message strings are in sync with error (LP: #1200568) Date: Fri, 12 Jul 2013 12:03:24 +0100 Message-Id: <1373627004-32380-1-git-send-email-colin.king@canonical.com> X-Mailer: git-send-email 1.8.1.2 X-BeenThere: fwts-devel@lists.ubuntu.com X-Mailman-Version: 2.1.14 Precedence: list List-Id: Firmware Test Suite Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: fwts-devel-bounces@lists.ubuntu.com Sender: fwts-devel-bounces@lists.ubuntu.com From: Colin Ian King We should use the AslErrorLevel[] strings that 1-to-1 match the ASL_MESSAGE_TYPES rather than defining our own. These strings come with trailing spaces, so we need to trim these off. Also report ASL_REMARKS since these may be helful and we've not yet been tracking these. Signed-off-by: Colin Ian King Acked-by: Alex Hung Acked-by: Ivan Hu --- src/acpi/syntaxcheck/syntaxcheck.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/src/acpi/syntaxcheck/syntaxcheck.c b/src/acpi/syntaxcheck/syntaxcheck.c index 61d46f8..44399cb 100644 --- a/src/acpi/syntaxcheck/syntaxcheck.c +++ b/src/acpi/syntaxcheck/syntaxcheck.c @@ -29,6 +29,8 @@ #include +#define ASL_EXCEPTIONS /* so we can include AslErrorLevel in aslmessages.h */ + #include "aslmessages.h" typedef struct { @@ -259,20 +261,20 @@ static const char *syntaxcheck_error_code_to_id(const uint32_t error_code) static const char *syntaxcheck_error_level(uint32_t error_code) { uint16_t error_level = syntaxcheck_error_code_to_error_level(error_code); + static char buf[64]; + char *ptr; - static char *error_levels[] = { - "warning (level 0)", - "warning (level 1)", - "warning (level 2)", - "error", - "remark", - "optimization", - "unknown", - }; + /* Out of range for some reason? */ + if (error_level >= ASL_NUM_REPORT_LEVELS) + return "Unknown"; - const int max_levels = (sizeof(error_levels) / sizeof(char*)) - 1; + /* AslErrorLevel strings are end-space padded, so strip off end spaces if any */ + strcpy(buf, AslErrorLevel[error_level]); + ptr = strchr(buf, ' '); + if (ptr) + *ptr = '\0'; - return error_levels[error_level > max_levels ? max_levels : error_level]; + return buf; } /* @@ -508,6 +510,8 @@ static int syntaxcheck_table(fwts_framework *fw, char *tablename, int which) fwts_failed(fw, LOG_LEVEL_HIGH, label, "Assembler error in line %d", num); break; case ASL_REMARK: + fwts_log_info(fw, "Assembler remark in line %d", num); + break; case ASL_OPTIMIZATION: skip = true; break;