From patchwork Fri Aug 28 16:45:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Markus Armbruster X-Patchwork-Id: 511959 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 7D2461401C7 for ; Sat, 29 Aug 2015 02:48:55 +1000 (AEST) Received: from localhost ([::1]:48928 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVMph-0004ak-IV for incoming@patchwork.ozlabs.org; Fri, 28 Aug 2015 12:48:53 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:54167) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVMn6-00088k-Os for qemu-devel@nongnu.org; Fri, 28 Aug 2015 12:46:14 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ZVMn3-0000Gn-Du for qemu-devel@nongnu.org; Fri, 28 Aug 2015 12:46:12 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35937) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ZVMn3-0000GM-94 for qemu-devel@nongnu.org; Fri, 28 Aug 2015 12:46:09 -0400 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (Postfix) with ESMTPS id D52818E66A; Fri, 28 Aug 2015 16:46:08 +0000 (UTC) Received: from blackfin.pond.sub.org (ovpn-116-73.ams2.redhat.com [10.36.116.73]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7SGk6mu015669 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=NO); Fri, 28 Aug 2015 12:46:08 -0400 Received: by blackfin.pond.sub.org (Postfix, from userid 1000) id 4D0823001102; Fri, 28 Aug 2015 18:46:06 +0200 (CEST) From: Markus Armbruster To: qemu-devel@nongnu.org Date: Fri, 28 Aug 2015 18:45:43 +0200 Message-Id: <1440780366-7177-4-git-send-email-armbru@redhat.com> In-Reply-To: <1440780366-7177-1-git-send-email-armbru@redhat.com> References: <1440780366-7177-1-git-send-email-armbru@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x X-Received-From: 209.132.183.28 Cc: mdroth@linux.vnet.ibm.com Subject: [Qemu-devel] [PATCH v2 03/26] qapi: Simplify guardname() X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org The guards around built-in declarations lose their _H. It never made much sense anyway. Signed-off-by: Markus Armbruster Reviewed-by: Eric Blake --- scripts/qapi.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/scripts/qapi.py b/scripts/qapi.py index e656beb..ba11c54 100644 --- a/scripts/qapi.py +++ b/scripts/qapi.py @@ -958,14 +958,9 @@ def mcgen(code, **kwds): code = code[1:] return cgen(code, **kwds) -def basename(filename): - return filename.split("/")[-1] def guardname(filename): - guard = basename(filename).rsplit(".", 1)[0] - for substr in [".", " ", "-"]: - guard = guard.replace(substr, "_") - return guard.upper() + '_H' + return c_name(filename, protect=False).upper() def guardstart(name): return mcgen(''' @@ -1035,6 +1030,7 @@ def parse_command_line(extra_options = "", extra_long_options = []): def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, c_comment, h_comment): + guard = guardname(prefix + h_file) c_file = output_dir + prefix + c_file h_file = output_dir + prefix + h_file @@ -1067,7 +1063,7 @@ def open_output(output_dir, do_c, do_h, prefix, c_file, h_file, #define %(guard)s ''', - comment = h_comment, guard = guardname(h_file))) + comment = h_comment, guard = guard)) return (fdef, fdecl)