From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 9325 invoked by alias); 21 Jan 2014 10:36:20 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 9315 invoked by uid 89); 21 Jan 2014 10:36:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.6 required=5.0 tests=AWL,BAYES_00,RP_MATCHES_RCVD,SPF_PASS autolearn=ham version=3.3.2 X-HELO: rock.gnat.com Received: from rock.gnat.com (HELO rock.gnat.com) (205.232.38.15) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Tue, 21 Jan 2014 10:36:18 +0000 Received: from localhost (localhost.localdomain [127.0.0.1]) by filtered-rock.gnat.com (Postfix) with ESMTP id 6A0B5116489 for ; Tue, 21 Jan 2014 05:36:16 -0500 (EST) Received: from rock.gnat.com ([127.0.0.1]) by localhost (rock.gnat.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id 2vERtURvC23m for ; Tue, 21 Jan 2014 05:36:16 -0500 (EST) Received: from joel.gnat.com (localhost.localdomain [127.0.0.1]) by rock.gnat.com (Postfix) with ESMTP id 05B3411646D for ; Tue, 21 Jan 2014 05:36:16 -0500 (EST) Received: by joel.gnat.com (Postfix, from userid 1000) id AC8D3E08C2; Tue, 21 Jan 2014 14:36:16 +0400 (RET) From: Joel Brobecker To: gdb-patches@sourceware.org Subject: [PATCH 1/2] Expand documentation of common-utils.h::FUNCTION_NAME Date: Tue, 21 Jan 2014 10:36:00 -0000 Message-Id: <1390300575-6998-1-git-send-email-brobecker@adacore.com> In-Reply-To: <20140118015244.GA22787@sourceware.org> References: <20140118015244.GA22787@sourceware.org> X-SW-Source: 2014-01/txt/msg00807.txt.bz2 Hello, While looking at this macro, I noticed that it wasn't always necessarily defined. That prompted me to search the current sources to make sure that all uses were adequately protected, which they were. But to help prevent future uses to be made unprotected, this patch expands the current macro documentation a bit. gdb/ChangeLog: * common/common-utils.h (FUNCTION_NAME): Expand the macro's documentation a bit. I would commit on its own, but since I am going to put the next in for the same macro up for review, it's just as easy to make that one wait as well, in case there are comments. Thanks, -- Joel --- gdb/common/common-utils.h | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/gdb/common/common-utils.h b/gdb/common/common-utils.h index 2d99549..5960c55 100644 --- a/gdb/common/common-utils.h +++ b/gdb/common/common-utils.h @@ -25,7 +25,12 @@ #include #include -/* Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' +/* If possible, define FUNCTION_NAME, a macro containing the name of + the function being defined. Since this macro may not always be + defined, all uses must be protected by appropriate macro definition + checks (Eg: "#ifdef FUNCTION_NAME"). + + Version 2.4 and later of GCC define a magical variable `__PRETTY_FUNCTION__' which contains the name of the function currently being defined. This is broken in G++ before version 2.6. C9x has a similar variable called __func__, but prefer the GCC one since -- 1.8.3.2