From patchwork Thu Jul 14 19:31:07 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnaud Lacombe X-Patchwork-Id: 975652 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter1.kernel.org (8.14.4/8.14.4) with ESMTP id p6EJVf7V005613 for ; Thu, 14 Jul 2011 19:31:42 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753888Ab1GNTbV (ORCPT ); Thu, 14 Jul 2011 15:31:21 -0400 Received: from mail-yi0-f46.google.com ([209.85.218.46]:61469 "EHLO mail-yi0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752804Ab1GNTbV (ORCPT ); Thu, 14 Jul 2011 15:31:21 -0400 Received: by yia27 with SMTP id 27so255448yia.19 for ; Thu, 14 Jul 2011 12:31:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=from:to:cc:subject:date:message-id:x-mailer; bh=RKDx/AHYuaQvtPrWeL72wOXfG4tXMYAq2sQgxMntRh0=; b=QWQKCkkMXyqaxiaR+fF8niQSUCDFyvfZfoOgJl3Ul1B9fC2xJGj1UAGeeT/oKtXXS2 FAGD8/5KyLBEc4EFMdOI0STJjTdWMCnW+cHbW/Gzj1NLMaQGfmUvESthqE8bWe34MSCQ pKCYr598z3NPhK4K3gN6Ipmt4paZG/Rnp1rQ0= Received: by 10.236.77.102 with SMTP id c66mr3941067yhe.303.1310671880432; Thu, 14 Jul 2011 12:31:20 -0700 (PDT) Received: from localhost.localdomain ([184.175.3.95]) by mx.google.com with ESMTPS id o47sm442966yhn.72.2011.07.14.12.31.18 (version=SSLv3 cipher=OTHER); Thu, 14 Jul 2011 12:31:19 -0700 (PDT) From: Arnaud Lacombe To: linux-kbuild@vger.kernel.org, Michal Marek Cc: Arnaud Lacombe , Randy Dunlap , Mauro Carvalho Chehab Subject: [PATCH] kconfig: fix missing "0x" prefix from S_HEX symbol in autoconf.h Date: Thu, 14 Jul 2011 15:31:07 -0400 Message-Id: <1310671867-5107-1-git-send-email-lacombar@gmail.com> X-Mailer: git-send-email 1.7.3.4.574.g608b.dirty Sender: linux-kbuild-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kbuild@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter1.kernel.org [140.211.167.41]); Thu, 14 Jul 2011 19:31:42 +0000 (UTC) The specialized printer for headers (espectially autoconf.h) is missing fixup code for S_HEX symbol's "0x" prefix. As long as kconfig does not warn for such missing prefix, this code is needed. Fix this. In the same time, fix some nits in `header_print_symbol()'. Cc: Randy Dunlap Cc: Mauro Carvalho Chehab Broken-by: Arnaud Lacombe (Somehow-)Reported-by: Randy Dunlap Reported-by: Mauro Carvalho Chehab Signed-off-by: Arnaud Lacombe Acked-by: Mauro Carvalho Chehab Acked-by: Randy Dunlap --- scripts/kconfig/confdata.c | 26 +++++++++++++++++++++----- 1 files changed, 21 insertions(+), 5 deletions(-) diff --git a/scripts/kconfig/confdata.c b/scripts/kconfig/confdata.c index be6952c..df629ec 100644 --- a/scripts/kconfig/confdata.c +++ b/scripts/kconfig/confdata.c @@ -487,27 +487,43 @@ static struct conf_printer kconfig_printer_cb = static void header_print_symbol(FILE *fp, struct symbol *sym, const char *value, void *arg) { - const char *suffix = ""; switch (sym->type) { case S_BOOLEAN: - case S_TRISTATE: + case S_TRISTATE: { + const char *suffix = ""; + switch (*value) { case 'n': return; case 'm': suffix = "_MODULE"; - /* FALLTHROUGH */ + /* fall through */ default: value = "1"; } + fprintf(fp, "#define %s%s%s %s\n", + CONFIG_, sym->name, suffix, value); + break; + } + case S_HEX: { + const char *prefix = ""; + + if (value[0] != '0' || (value[1] != 'x' && value[1] != 'X')) + prefix = "0x"; + fprintf(fp, "#define %s%s %s%s\n", + CONFIG_, sym->name, prefix, value); + break; + } + case S_STRING: + case S_INT: + fprintf(fp, "#define %s%s %s\n", + CONFIG_, sym->name, value); break; default: break; } - fprintf(fp, "#define %s%s%s %s\n", - CONFIG_, sym->name, suffix, value); } static void