Author: mdiep
Date: Tue Apr 24 14:18:22 2007
New Revision: 18329

Modified:
   trunk/compilers/imcc/reg_alloc_bc.c
   trunk/include/parrot/atomic.h
   trunk/include/parrot/atomic/fallback.h
   trunk/include/parrot/atomic/gcc_pcc.h
   trunk/include/parrot/atomic/gcc_x86.h
   trunk/include/parrot/atomic/sparc.h
   trunk/include/parrot/events.h
   trunk/include/parrot/exec.h
   trunk/include/parrot/inter_call.h
   trunk/include/parrot/op.h
   trunk/include/parrot/oplib.h
   trunk/include/parrot/pobj.h
   trunk/include/parrot/slice.h
   trunk/src/bignum.c
   trunk/src/bignum.h
   trunk/src/charset.c
   trunk/src/encoding.c
   trunk/src/events.c
   trunk/src/gc/gc_gms.c
   trunk/src/gc/gc_ims.c
   trunk/src/gc/register.c
   trunk/src/interpreter.c
   trunk/src/jit.h
   trunk/src/jit/ia64/jit_emit.h
   trunk/src/jit_debug.c
   trunk/src/jit_debug_xcoff.c
   trunk/src/nci_test.c
   trunk/src/pmc/bigint.pmc
   trunk/src/pmc/capture.pmc
   trunk/src/utils.c
   trunk/t/codingstd/c_struct.t
   trunk/t/harness

Log:
[core]: Tag all our structs

Modified: trunk/compilers/imcc/reg_alloc_bc.c
==============================================================================
--- trunk/compilers/imcc/reg_alloc_bc.c (original)
+++ trunk/compilers/imcc/reg_alloc_bc.c Tue Apr 24 14:18:22 2007
@@ -44,13 +44,13 @@
 static void compute_spilling_costs(Parrot_Interp, IMC_Unit *);
 
 /***************** New graph algorithm stuff *********************/
-typedef struct {
+typedef struct node {
     int deg;     /* degree of node (# neighbors) */
     int col;     /* color assigned to this node */
     int id;      /* original index */
     char in;     /* boolean, indicating if removed yet */
 } node;
-typedef struct {
+typedef struct graph {
     int n;       /* number of nodes */
     int k;       /* maximum color used in graph (0 means uncolored) */
     node* V;     /* array of nodes */

Modified: trunk/include/parrot/atomic.h
==============================================================================
--- trunk/include/parrot/atomic.h       (original)
+++ trunk/include/parrot/atomic.h       Tue Apr 24 14:18:22 2007
@@ -32,7 +32,7 @@
 #    include "parrot/atomic/fallback.h"
 #  endif
 #else
-typedef struct {
+typedef struct Parrot_atomic_pointer {
     void *val;
 } Parrot_atomic_pointer;
 

Modified: trunk/include/parrot/atomic/fallback.h
==============================================================================
--- trunk/include/parrot/atomic/fallback.h      (original)
+++ trunk/include/parrot/atomic/fallback.h      Tue Apr 24 14:18:22 2007
@@ -14,12 +14,12 @@
 #if !defined(PARROT_ATOMIC_FALLBACK_H_GAURD)
 #  define PARROT_ATOMIC_FALLBACK_H_GAURD
 
-typedef struct {
+typedef struct Parrot_atomic_pointer {
     void *val;
     Parrot_mutex lock;
 } Parrot_atomic_pointer;
 
-typedef struct {
+typedef struct Parrot_atomic_integer {
     INTVAL val;
     Parrot_mutex lock;
 } Parrot_atomic_integer;

Modified: trunk/include/parrot/atomic/gcc_pcc.h
==============================================================================
--- trunk/include/parrot/atomic/gcc_pcc.h       (original)
+++ trunk/include/parrot/atomic/gcc_pcc.h       Tue Apr 24 14:18:22 2007
@@ -15,7 +15,7 @@
 #if !defined(ATOMIC_GCC_PCC_H_GAURD)
 #  define ATOMIC_GCC_PCC_H_GAURD
 
-typedef struct {
+typedef struct Parrot_atomic_pointer {
     void * volatile val;
 } Parrot_atomic_pointer;
 
@@ -81,7 +81,7 @@
 
 #  define PARROT_ATOMIC_PTR_DESTROY(a)
 
-typedef struct {
+typedef struct Parrot_atomic_integer {
     volatile long val;
 } Parrot_atomic_integer;
 

Modified: trunk/include/parrot/atomic/gcc_x86.h
==============================================================================
--- trunk/include/parrot/atomic/gcc_x86.h       (original)
+++ trunk/include/parrot/atomic/gcc_x86.h       Tue Apr 24 14:18:22 2007
@@ -15,11 +15,11 @@
 #if !defined(PARROT_ATOMIC_GCC_X86_H_GAURD)
 #  define PARROT_ATOMIC_GCC_X86_H_GAURD
 
-typedef struct {
+typedef struct Parrot_atomic_pointer {
     void *volatile val;
 } Parrot_atomic_pointer;
 
-typedef struct {
+typedef struct Parrot_atomic_integer {
     volatile long val;
 } Parrot_atomic_integer;
 

Modified: trunk/include/parrot/atomic/sparc.h
==============================================================================
--- trunk/include/parrot/atomic/sparc.h (original)
+++ trunk/include/parrot/atomic/sparc.h Tue Apr 24 14:18:22 2007
@@ -24,7 +24,7 @@
 extern int parrot_sparc_cas64(INTVAL *value, INTVAL old, INTVAL new);
 #  endif
 
-typedef struct {
+typedef struct Parrot_atomic_pointer {
     void * volatile val;
 } Parrot_atomic_pointer;
 
@@ -50,7 +50,7 @@
 
 #  define PARROT_ATOMIC_PTR_DESTROY(a)
 
-typedef struct {
+typedef struct Parrot_atomic_integer {
     volatile Parrot_Int4 val;
 } Parrot_atomic_integer;
 

Modified: trunk/include/parrot/events.h
==============================================================================
--- trunk/include/parrot/events.h       (original)
+++ trunk/include/parrot/events.h       Tue Apr 24 14:18:22 2007
@@ -33,7 +33,7 @@
 /*
  * any timer event has 2 time fields in front
  */
-typedef struct {
+typedef struct parrot_timer_event {
     FLOATVAL                    abs_time;
     FLOATVAL                    interval;
     int                         repeat; /* 0 = once, -1 = forever */
@@ -48,19 +48,19 @@
     EV_IO_SELECT_WR             /* rd is ready for write */
 } parrot_io_event_enum;
 
-typedef struct {
+typedef struct parrot_io_event {
     parrot_io_event_enum        action; /* read, write, ... */
     PMC*                        pio;
     PMC*                        handler;
     PMC*                        user_data;
 } parrot_io_event;
 
-typedef struct {
+typedef struct _call_back_info {
     PMC*                        cbi;    /* callback info */
     void*                       external_data;
 } _call_back_info;
 
-typedef struct {
+typedef struct parrot_event {
     parrot_event_type_enum      type;
     Parrot_Interp               interp;
     /* event_func_t                event_func; unused */

Modified: trunk/include/parrot/exec.h
==============================================================================
--- trunk/include/parrot/exec.h (original)
+++ trunk/include/parrot/exec.h Tue Apr 24 14:18:22 2007
@@ -58,25 +58,25 @@
 #  define RTYPE_FUNC  3   /* Function */
 #  define RTYPE_DATA1 4   /* 2nd. rellocation for RISC machines */
 
-typedef struct {
+typedef struct Parrot_exec_symbol_t {
     int                                                 offset_list;
     int                                                 type;
     int                                                 value;
     const char                                         *symbol;
 } Parrot_exec_symbol_t;
 
-typedef struct {
+typedef struct Parrot_exec_rellocation_t {
     int                                                 offset;
     short                                               symbol_number;
     int                                                 type;
 } Parrot_exec_rellocation_t;
 
-typedef struct {
+typedef struct Parrot_exec_section_t {
     char                                               *code;
     int                                                 size;
 } Parrot_exec_section_t;
 
-typedef struct {
+typedef struct Parrot_exec_objfile_t {
     Parrot_exec_section_t                               text;
     Parrot_exec_section_t                               data;
     Parrot_exec_section_t                               bss;

Modified: trunk/include/parrot/inter_call.h
==============================================================================
--- trunk/include/parrot/inter_call.h   (original)
+++ trunk/include/parrot/inter_call.h   Tue Apr 24 14:18:22 2007
@@ -31,11 +31,11 @@
 typedef struct call_state_item {
     int mode;       /* from_sig, from_set_ops, flatten ...*/
     union {
-        struct {
+        struct sig {
             void *ap;   /* a ptr to va_list */
             const char *sig;
         } sig;
-        struct {
+        struct op {
             opcode_t *pc;
             PMC *signature;
         } op;

Modified: trunk/include/parrot/op.h
==============================================================================
--- trunk/include/parrot/op.h   (original)
+++ trunk/include/parrot/op.h   Tue Apr 24 14:18:22 2007
@@ -72,7 +72,7 @@
 ** its op function (since we may not be using op functions).
 */
 
-typedef struct {
+typedef struct op_info_t {
     /* op_type_t type; unused */
     const char *name;
     const char *full_name;

Modified: trunk/include/parrot/oplib.h
==============================================================================
--- trunk/include/parrot/oplib.h        (original)
+++ trunk/include/parrot/oplib.h        Tue Apr 24 14:18:22 2007
@@ -21,7 +21,7 @@
 ** op_lib_t
 */
 
-typedef struct {
+typedef struct op_lib_t {
     const char *name;
     const char *suffix;
     int      core_type;

Modified: trunk/include/parrot/pobj.h
==============================================================================
--- trunk/include/parrot/pobj.h (original)
+++ trunk/include/parrot/pobj.h Tue Apr 24 14:18:22 2007
@@ -16,15 +16,15 @@
 #include "parrot/config.h"
 
 typedef union UnionVal {
-    struct {                                  /* One Buffer structure */
+    struct _b {                                  /* One Buffer structure */
         void *     _bufstart;
         size_t     _buflen;
     } _b;
-    struct {                                  /* or two pointers, both are 
defines */
+    struct _ptrs {                                  /* or two pointers, both 
are defines */
         DPOINTER * _struct_val;
         PMC *      _pmc_val;
     } _ptrs;
-    struct {
+    struct _i {
         INTVAL _int_val;                      /* or 2 intvals */
         INTVAL _int_val2;
     } _i;

Modified: trunk/include/parrot/slice.h
==============================================================================
--- trunk/include/parrot/slice.h        (original)
+++ trunk/include/parrot/slice.h        Tue Apr 24 14:18:22 2007
@@ -15,7 +15,7 @@
 
 #ifdef PARROT_IN_CORE
 
-typedef struct {
+typedef struct RUnion {
     INTVAL i;
     STRING *s;
 } RUnion;

Modified: trunk/src/bignum.c
==============================================================================
--- trunk/src/bignum.c  (original)
+++ trunk/src/bignum.c  Tue Apr 24 14:18:22 2007
@@ -170,7 +170,8 @@
     BN_DIV_REMAIN
 } BN_DIV_ENUM;
 
-typedef struct { /* Used to restore INTENT(IN) arguments to functions */
+/* Used to restore INTENT(IN) arguments to functions */
+typedef struct BN_SAVE_PREC {
     BIGNUM one;
     BIGNUM two;
 } BN_SAVE_PREC;

Modified: trunk/src/bignum.h
==============================================================================
--- trunk/src/bignum.h  (original)
+++ trunk/src/bignum.h  Tue Apr 24 14:18:22 2007
@@ -68,7 +68,7 @@
  nibs == 3, digits == 14
 */
 
-typedef struct {
+typedef struct parrot_bignum_t {
     BN_NIB* buffer; /* string of nibbles */
     UINTVAL nibs;   /* nibs allocated, in sizeof(BN_NIB) */
     UINTVAL flags;  /* private flags store: 001 Inf,  010 qNAN, 110 sNAN */
@@ -100,7 +100,7 @@
     BN_F_UNDERFLOW = 64
 } parrot_bignum_context_flags;
 
-typedef struct {
+typedef struct parrot_bignum_context {
     INTVAL precision;     /* number of digs to retain */
     INTVAL elimit;        /* maximum exponent allowed */
     BN_ROUNDING rounding; /* rounding type to perform */

Modified: trunk/src/charset.c
==============================================================================
--- trunk/src/charset.c (original)
+++ trunk/src/charset.c Tue Apr 24 14:18:22 2007
@@ -39,19 +39,19 @@
  * all registered charsets are collected in one global structure
  */
 
-typedef struct {
+typedef struct To_converter {
     CHARSET *to;
     charset_converter_t func;
 } To_converter;
 
-typedef struct {
+typedef struct One_charset {
     CHARSET *charset;
     STRING  *name;
     int n_converters;
     To_converter *to_converters;
 } One_charset;
 
-typedef struct {
+typedef struct All_charsets {
     int n_charsets;
     One_charset *set;
 } All_charsets;

Modified: trunk/src/encoding.c
==============================================================================
--- trunk/src/encoding.c        (original)
+++ trunk/src/encoding.c        Tue Apr 24 14:18:22 2007
@@ -25,12 +25,12 @@
 ENCODING *Parrot_ucs2_encoding_ptr;
 ENCODING *Parrot_utf16_encoding_ptr;
 
-typedef struct {
+typedef struct One_encoding {
     ENCODING *encoding;
     STRING  *name;
 } One_encoding;
 
-typedef struct {
+typedef struct All_encodings {
     int n_encodings;
     One_encoding *enc;
 } All_encodings;

Modified: trunk/src/events.c
==============================================================================
--- trunk/src/events.c  (original)
+++ trunk/src/events.c  Tue Apr 24 14:18:22 2007
@@ -106,7 +106,7 @@
 /*
  * a structure to communicate with the io_thread
  */
-typedef struct {
+typedef struct io_thread_msg {
     io_thread_msg_type command;
     parrot_event *ev;
 } io_thread_msg;
@@ -657,7 +657,7 @@
 */
 
 #ifndef WIN32
-typedef struct {
+typedef struct pending_io_events {
     int n;
     int alloced;
     parrot_event **events;

Modified: trunk/src/gc/gc_gms.c
==============================================================================
--- trunk/src/gc/gc_gms.c       (original)
+++ trunk/src/gc/gc_gms.c       Tue Apr 24 14:18:22 2007
@@ -164,7 +164,7 @@
  */
 #  define GC_GMS_DEBUG 0
 
-typedef struct {
+typedef struct Gc_gms_private {
     UINTVAL current_gen_no;             /* the nursery generation number */
 } Gc_gms_private;
 
@@ -697,7 +697,7 @@
     gc_gms_promote(interp, nh, ah->gen->gen_no);
 }
 
-typedef struct {
+typedef struct Gc_gms_plan {
     int merge_gen;
     int gen_no;
 } Gc_gms_plan;

Modified: trunk/src/gc/gc_ims.c
==============================================================================
--- trunk/src/gc/gc_ims.c       (original)
+++ trunk/src/gc/gc_ims.c       Tue Apr 24 14:18:22 2007
@@ -388,7 +388,7 @@
 
 } gc_ims_state_enum;
 
-typedef struct {
+typedef struct Gc_ims_private {
     gc_ims_state_enum   state;
     size_t      allocations;    /* get_free_object count */
     size_t      alloc_trigger;  /* after this number of allocations a gc

Modified: trunk/src/gc/register.c
==============================================================================
--- trunk/src/gc/register.c     (original)
+++ trunk/src/gc/register.c     Tue Apr 24 14:18:22 2007
@@ -487,7 +487,7 @@
 
 */
 
-typedef struct {
+typedef struct save_regs_t {
     Regs_ni  old_bp_ni;   /* restoreall just resets ptrs */
     Regs_ps  old_bp_ps;
     Regs_ps  bp_ps;       /* pushed regs need DOD marking */

Modified: trunk/src/interpreter.c
==============================================================================
--- trunk/src/interpreter.c     (original)
+++ trunk/src/interpreter.c     Tue Apr 24 14:18:22 2007
@@ -551,7 +551,7 @@
 #  ifdef PARROT_EXEC_OS_AIX
     /* AIX calling convention requires that function-call-by-ptr be made
        through the following struct: */
-    struct { jit_f functPtr; void *toc; void *env; } ptrgl_t;
+    struct ptrgl_t { jit_f functPtr; void *toc; void *env; } ptrgl_t;
     ptrgl_t.functPtr = (jit_f) D2FPTR(init_jit(interp, pc));
     ptrgl_t.env = NULL;
 

Modified: trunk/src/jit.h
==============================================================================
--- trunk/src/jit.h     (original)
+++ trunk/src/jit.h     Tue Apr 24 14:18:22 2007
@@ -65,7 +65,7 @@
  *  fixups:         List of fixupes.
  */
 
-typedef struct {
+typedef struct Parrot_jit_arena_t {
     char                            *start;
     ptrdiff_t                        size;
     Parrot_jit_opmap_t              *op_map;
@@ -102,7 +102,7 @@
  *  reg_dir:        If the register needs to be loaded or saved.
  *  registers_used: count of used registers
  */
-typedef struct {
+typedef struct Parrot_jit_register_usage_t {
     int                                 reg_count[NUM_REGISTERS];
     unsigned int                        reg_usage[NUM_REGISTERS];
     char                                reg_dir[NUM_REGISTERS];
@@ -142,7 +142,7 @@
  *  has_unpredictable_jump: XXX need to define how to handle this.
  */
 
-typedef struct {
+typedef struct Parrot_jit_optimizer_t {
     Parrot_jit_optimizer_section_t  *sections;
     Parrot_jit_optimizer_section_t  *cur_section;
     char                            *map_branch;
@@ -155,7 +155,7 @@
  *      Constants pool information.
  *
  */
-typedef struct {
+typedef struct Parrot_jit_constant_pool_t {
     long                             frames_used;
     long                             cur_used;
     char                            *cur_const;
@@ -187,7 +187,7 @@
  *  constant_pool:  The constant pool information.
  */
 
-typedef struct {
+typedef struct Parrot_jit_info_t {
     opcode_t                        *prev_op;
     opcode_t                        *cur_op;
     opcode_t                         op_i;
@@ -221,7 +221,7 @@
  *                  also used for vtable functions, extcall is #of vtable func
  */
 
-typedef struct {
+typedef struct Parrot_jit_fn_info_t {
     jit_fn_t                        fn;
     int                            extcall;
 } Parrot_jit_fn_info_t;
@@ -268,7 +268,7 @@
  */
 typedef void (*jit_arch_f)(Parrot_jit_info_t *, Interp *);
 
-typedef struct {
+typedef struct jit_arch_regs {
     /*
      * begin function - emit ABI call prologue
      */

Modified: trunk/src/jit/ia64/jit_emit.h
==============================================================================
--- trunk/src/jit/ia64/jit_emit.h       (original)
+++ trunk/src/jit/ia64/jit_emit.h       Tue Apr 24 14:18:22 2007
@@ -23,7 +23,7 @@
 int inst_size = 0;
 int inst_tmpl = 0;
 
-typedef struct {
+typedef struct  inst_tmp_t {
     char    tmplt;
     char    used;
     unsigned long    inst1;

Modified: trunk/src/jit_debug.c
==============================================================================
--- trunk/src/jit_debug.c       (original)
+++ trunk/src/jit_debug.c       Tue Apr 24 14:18:22 2007
@@ -85,7 +85,7 @@
 #  define BYTE_SIZE(t) ((int)sizeof (t))
 #  define BIT_OFFSET(str, field) ((int)(offsetof(str, field) * 8))
 
-typedef struct {
+typedef struct BaseTypes {
     const char *name;
     const char *spec;
 } BaseTypes;

Modified: trunk/src/jit_debug_xcoff.c
==============================================================================
--- trunk/src/jit_debug_xcoff.c (original)
+++ trunk/src/jit_debug_xcoff.c Tue Apr 24 14:18:22 2007
@@ -54,7 +54,7 @@
 #  define BYTE_SIZE(t) ((int)sizeof (t))
 #  define BIT_OFFSET(str, field) ((int)(offsetof(str, field) * 8))
 
-typedef struct {
+typedef struct BaseTypes {
     const char *name;
     const char *spec;
 } BaseTypes;

Modified: trunk/src/nci_test.c
==============================================================================
--- trunk/src/nci_test.c        (original)
+++ trunk/src/nci_test.c        Tue Apr 24 14:18:22 2007
@@ -36,16 +36,16 @@
 
 /* Declarations of structs */
 
-typedef struct {
+typedef struct Nested {
     int y;
 } Nested;
 
-typedef struct {
+typedef struct Outer {
     int x;
     Nested *nested;
 } Outer;
 
-typedef struct {
+typedef struct Rect_Like {
     int x, y;
     int w, h;
 } Rect_Like;

Modified: trunk/src/pmc/bigint.pmc
==============================================================================
--- trunk/src/pmc/bigint.pmc    (original)
+++ trunk/src/pmc/bigint.pmc    Tue Apr 24 14:18:22 2007
@@ -30,7 +30,7 @@
 
 #ifdef PARROT_HAS_GMP
 #  include <gmp.h>
-typedef struct {
+typedef struct BIGINT {
     mpz_t b;
 } BIGINT;
 

Modified: trunk/src/pmc/capture.pmc
==============================================================================
--- trunk/src/pmc/capture.pmc   (original)
+++ trunk/src/pmc/capture.pmc   Tue Apr 24 14:18:22 2007
@@ -20,7 +20,7 @@
 
 #include "parrot/parrot.h"
 
-typedef struct {
+typedef struct Capture_data {
     PMC *array;                /* array component */
     PMC *hash;                 /* hash component */
 } Capture_data;

Modified: trunk/src/utils.c
==============================================================================
--- trunk/src/utils.c   (original)
+++ trunk/src/utils.c   Tue Apr 24 14:18:22 2007
@@ -23,7 +23,7 @@
 #include "parrot/parrot.h"
 
 /* Parrot_register_move companion functions i and data */
-typedef struct {
+typedef struct parrot_prm_context {
     unsigned char *dest_regs;
     unsigned char *src_regs;
     unsigned char temp_reg;

Modified: trunk/t/codingstd/c_struct.t
==============================================================================
--- trunk/t/codingstd/c_struct.t        (original)
+++ trunk/t/codingstd/c_struct.t        Tue Apr 24 14:18:22 2007
@@ -42,10 +42,12 @@
     open my $fh, '<', $path
         or die "Cannot open '$path' for reading: $!\n";
 
-    my $count;
+    my $count   = 0;
     my $message = qq<  $path:>;
     while (<$fh>) {
-        next unless /\bstruct\s+{/;
+        # we're only interested in lines with structs
+        next unless /\btypedef\s+struct\s+{/;
+
         $count++;
         $message .= " $.";
     }

Modified: trunk/t/harness
==============================================================================
--- trunk/t/harness     (original)
+++ trunk/t/harness     Tue Apr 24 14:18:22 2007
@@ -170,6 +170,7 @@
 my @coding_std_tests = map { "t/codingstd/$_" } qw(
     c_code_coda.t 
     c_indent.t
+    c_struct.t
     cppcomments.t 
     cuddled_else.t 
     gmt_utc.t

Reply via email to