From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 11537 invoked by alias); 29 Jul 2009 15:32:33 -0000 Received: (qmail 11529 invoked by uid 22791); 29 Jul 2009 15:32:33 -0000 X-SWARE-Spam-Status: No, hits=-2.3 required=5.0 tests=AWL,BAYES_00,SPF_HELO_PASS,SPF_PASS X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (66.187.233.31) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 29 Jul 2009 15:32:23 +0000 Received: from int-mx1.corp.redhat.com (int-mx1.corp.redhat.com [172.16.52.254]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id n6TFWLbQ012714 for ; Wed, 29 Jul 2009 11:32:21 -0400 Received: from ns3.rdu.redhat.com (ns3.rdu.redhat.com [10.11.255.199]) by int-mx1.corp.redhat.com (8.13.1/8.13.1) with ESMTP id n6TFWKPa000315 for ; Wed, 29 Jul 2009 11:32:20 -0400 Received: from opsy.redhat.com (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by ns3.rdu.redhat.com (8.13.8/8.13.8) with ESMTP id n6TFWJbN024282; Wed, 29 Jul 2009 11:32:20 -0400 Received: by opsy.redhat.com (Postfix, from userid 500) id 4DEA35081C4; Wed, 29 Jul 2009 09:32:19 -0600 (MDT) To: Vladimir Prus Cc: gdb@sources.redhat.com Subject: Re: Private data members References: <200907291245.32359.vladimir@codesourcery.com> From: Tom Tromey Reply-To: tromey@redhat.com Date: Wed, 29 Jul 2009 15:32:00 -0000 In-Reply-To: <200907291245.32359.vladimir@codesourcery.com> (Vladimir Prus's message of "Wed\, 29 Jul 2009 12\:45\:32 +0400") Message-ID: User-Agent: Gnus/5.11 (Gnus v5.11) Emacs/22.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2009-07/txt/msg00228.txt.bz2 >>>>> "Volodya" == Vladimir Prus writes: Volodya> I have run into a case when it's desirable that all Volodya> modifications of a certain structure field in GDB codebase go Volodya> via function that can enforce necessary invariants. Volodya> At the moment, there are at least 3 places that directly assign Volodya> a value to that field, and while I can convert them easily, Volodya> nothing will prevent a direct assignment to appear in future. In the past somebody solved this same problem for struct value by putting the struct definition into value.c and adding a bunch of accessors. I'm lukewarm about this technique, but it can be made to work. Daniel's suggested approach would also be fine with me. If you want a real guarantee, you could write an spatch script to detect assignments to this field, and run it periodically. Tom