From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 21148 invoked by alias); 20 Feb 2008 02:22:02 -0000 Received: (qmail 21075 invoked by uid 440); 20 Feb 2008 02:22:00 -0000 Date: Wed, 20 Feb 2008 02:22:00 -0000 Message-ID: <20080220022200.21060.qmail@sourceware.org> From: scox@sourceware.org To: frysk-cvs@sourceware.org Subject: [SCM] master: Allow for struct/class accessibility defaults. X-Git-Refname: refs/heads/master X-Git-Reftype: branch X-Git-Oldrev: 2f1786f6895999c01fd41be95f3e902a1d760acc X-Git-Newrev: 312f766777c680ddc21a09ef364283882e1cfdac Mailing-List: contact frysk-cvs-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Post: List-Help: , Sender: frysk-cvs-owner@sourceware.org Reply-To: frysk@sourceware.org X-SW-Source: 2008-q1/txt/msg00232.txt.bz2 The branch, master has been updated via 312f766777c680ddc21a09ef364283882e1cfdac (commit) from 2f1786f6895999c01fd41be95f3e902a1d760acc (commit) Those revisions listed above that are new to this repository have not appeared on any other notification email. - Log ----------------------------------------------------------------- commit 312f766777c680ddc21a09ef364283882e1cfdac Author: Stan Cox Date: Tue Feb 19 21:10:57 2008 -0500 Allow for struct/class accessibility defaults. * funit-type-class.cxx (class_accessibility): New. * CompositeType.java (toPrint): Allow for struct/class access defaults. ----------------------------------------------------------------------- Summary of changes: frysk-core/frysk/pkglibdir/ChangeLog | 4 ++ frysk-core/frysk/pkglibdir/funit-type-class.cxx | 56 ++++++++++++++++------- frysk-core/frysk/value/ChangeLog | 4 ++ frysk-core/frysk/value/CompositeType.java | 23 ++++++--- 4 files changed, 63 insertions(+), 24 deletions(-) First 500 lines of diff: diff --git a/frysk-core/frysk/pkglibdir/ChangeLog b/frysk-core/frysk/pkglibdir/ChangeLog index ec56b56..0960eaa 100644 --- a/frysk-core/frysk/pkglibdir/ChangeLog +++ b/frysk-core/frysk/pkglibdir/ChangeLog @@ -1,3 +1,7 @@ +2008-02-19 Stan Cox + + * funit-type-class.cxx (class_accessibility): New. + 2008-02-08 Stan Cox * funit-quicksort.c (main): Add bubblesort for cross frame/file testing. diff --git a/frysk-core/frysk/pkglibdir/funit-type-class.cxx b/frysk-core/frysk/pkglibdir/funit-type-class.cxx index df008de..25b1154 100644 --- a/frysk-core/frysk/pkglibdir/funit-type-class.cxx +++ b/frysk-core/frysk/pkglibdir/funit-type-class.cxx @@ -1,6 +1,6 @@ // This file is part of the program FRYSK. // -// Copyright 2007, Red Hat Inc. +// Copyright 2007, 2008, Red Hat Inc. // // FRYSK is free software; you can redistribute it and/or modify it // under the terms of the GNU General Public License as published by @@ -45,6 +45,32 @@ static void crash (){ a[0] = 0; } +class class_accessibility { + private: + long int long_var; + int int_var; + public: + short int short_var; + protected: + float float_var; + public: + void set_int_var (int int_var); +} class_accessibility; + +// Test: Class +// Name: class_accessibility +// Type: class class_accessibility { +// Type: private: +// Type: long int long_var; +// Type: int int_var; +// Type: public: +// Type: short int short_var; +// Type: protected: +// Type: float float_var; +// Type: public: +// Type: void set_int_var (int); +// Type: } + class Base1 { public: @@ -108,10 +134,8 @@ private: } }; -// Test: Class -// Name: mb +// Name: class_inherited // Type: class Type { -// Type: public: // Type: struct Base1 { // Type: const char *msg; // Type: void Base1 (const char *); @@ -124,15 +148,15 @@ private: // Type: } ; // Type: private: // Type: const char *note; +// Type: public: // Type: void Type (const char *,const char *,const char *); // Type: void ~Type (); // Type: } -Type mb("static", "main", "mb"); +Type class_inherited("static", "main", "mb"); -// Name: new_base +// Name: class_inherited_new // Type: class Type { -// Type: public: // Type: struct Base1 { // Type: const char *msg; // Type: void Base1 (const char *); @@ -145,15 +169,15 @@ Type mb("static", "main", "mb"); // Type: } ; // Type: private: // Type: const char *note; +// Type: public: // Type: void Type (const char *,const char *,const char *); // Type: void ~Type (); // Type: } -Type new_base = Type ("new base", "main", "new_base"); +Type class_inherited_new = Type ("new base", "main", "new_base"); -// Name: xyz +// Name: class_template // Type: class Derived { -// Type: public: // Type: struct Base3 { // Type: int (**_vptr.Base3) (); // Type: void Base3 (void * const &); @@ -178,17 +202,17 @@ Type new_base = Type ("new base", "main", "new_base"); // Type: float do_this_impl (float); // Type: } -Derived xyz; +Derived class_template; static void func () __attribute__ ((noinline)); void func () { - xyz.do_this ((char)'1'); - xyz.do_this ((short)2); - xyz.do_this ((int)3); - xyz.do_this ((float) 4.1); - xyz.do_this ((int)1); + class_template.do_this ((char)'1'); + class_template.do_this ((short)2); + class_template.do_this ((int)3); + class_template.do_this ((float) 4.1); + class_template.do_this ((int)1); crash(); } diff --git a/frysk-core/frysk/value/ChangeLog b/frysk-core/frysk/value/ChangeLog index d4f5f86..7159a99 100644 --- a/frysk-core/frysk/value/ChangeLog +++ b/frysk-core/frysk/value/ChangeLog @@ -1,3 +1,7 @@ +2008-02-19 Stan Cox + + * CompositeType.java (toPrint): Allow for struct/class access defaults. + 2008-02-19 Nurdin Premji * TestInterface.java: New. diff --git a/frysk-core/frysk/value/CompositeType.java b/frysk-core/frysk/value/CompositeType.java index f0c7722..fd6f325 100644 --- a/frysk-core/frysk/value/CompositeType.java +++ b/frysk-core/frysk/value/CompositeType.java @@ -353,18 +353,25 @@ public abstract class CompositeType member = null; } // { content ... } - Access previousAccess = null; + Access previousAccess; + Access currentAccess; + Access defaultAccess; + if (this instanceof ClassType) + defaultAccess = Access.PRIVATE; + else + defaultAccess = Access.PUBLIC; + previousAccess = defaultAccess; + stringBuilder.append(" {\n"); StringBuilder memberStringBuilder = new StringBuilder(); while (member != null) { - if (member.access != previousAccess) { - previousAccess = member.access; - if (member.access != null) { - stringBuilder.append(" "); - stringBuilder.append(member.access.toPrint()); - stringBuilder.append(":\n"); - } + currentAccess = (member.access != null) ? member.access : defaultAccess; + if (currentAccess != previousAccess) { + previousAccess = currentAccess; + stringBuilder.append(" "); + stringBuilder.append(currentAccess.toPrint()); + stringBuilder.append(":\n"); } memberStringBuilder.delete(0, memberStringBuilder.length()); memberStringBuilder.append(" " + member.name); hooks/post-receive -- frysk system monitor/debugger