aboutsummaryrefslogtreecommitdiff
path: root/sim
diff options
context:
space:
mode:
authorMike Frysinger <vapier@gentoo.org>2011-04-02 05:30:16 +0000
committerMike Frysinger <vapier@gentoo.org>2011-04-02 05:30:16 +0000
commit12c4cbd553579257a4902267b2301984434cec7b (patch)
treeb6228ef9e739eb92a626f7d837f223f812ec2b28 /sim
parent4368ebebd815a95ace43dba87fbe800a37d314cf (diff)
downloadgdb-12c4cbd553579257a4902267b2301984434cec7b.zip
gdb-12c4cbd553579257a4902267b2301984434cec7b.tar.gz
gdb-12c4cbd553579257a4902267b2301984434cec7b.tar.bz2
sim: fix up style a bit
This touches up the code a bit to match GNU style. No functional changes. Signed-off-by: Mike Frysinger <vapier@gentoo.org>
Diffstat (limited to 'sim')
-rw-r--r--sim/common/ChangeLog21
-rw-r--r--sim/common/hw-alloc.c3
-rw-r--r--sim/common/hw-base.c30
-rw-r--r--sim/common/hw-device.h9
-rw-r--r--sim/common/hw-events.c6
-rw-r--r--sim/common/hw-handles.c6
-rw-r--r--sim/common/hw-instances.c3
-rw-r--r--sim/common/hw-instances.h3
-rw-r--r--sim/common/hw-main.h6
-rw-r--r--sim/common/hw-ports.c9
-rw-r--r--sim/common/hw-ports.h3
-rw-r--r--sim/common/hw-properties.c3
-rw-r--r--sim/common/hw-properties.h15
-rw-r--r--sim/common/hw-tree.c100
14 files changed, 137 insertions, 80 deletions
diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog
index 99ce8d8..71d3fef 100644
--- a/sim/common/ChangeLog
+++ b/sim/common/ChangeLog
@@ -1,3 +1,24 @@
+2011-04-02 Mike Frysinger <vapier@gentoo.org>
+
+ * hw-alloc.c (hw_alloc_data): Adjust brace.
+ * hw-base.c (hw_base_data): Likewise.
+ (generic_hw_unit_decode): Fix indentation.
+ * hw-device.h (_hw_unit, enum, hw): Adjust braces.
+ * hw-events.c (hw_event, hw_event_data): Likewise.
+ * hw-handles.c (hw_handle_mapping, hw_handle_data): Likewise.
+ * hw-instances.c (hw_instance_data): Likewise.
+ * hw-instances.h (hw_instance): Likewise.
+ * hw-main.h (hw_descriptor, enum): Likewise.
+ * hw-ports.c (hw_port_edge, hw_port_data, empty_hw_ports): Likewise.
+ * hw-ports.h (hw_port_descriptor): Likewise.
+ * hw-properties.c (hw_property_data): Likewise.
+ * hw-properties.h (enum, hw_property, _ihandle_runtime_property_spec,
+ _range_property_spec, _reg_property_spec): Likewise.
+ * hw-tree.c (_name_specifier, printer): Likewise.
+ (split_device_specifier, parse_string_property, hw_tree_traverse,
+ print_size, print_reg_property, print_string, print_properties):
+ Fix indentation.
+
2011-03-29 Mike Frysinger <vapier@gentoo.org>
* aclocal.m4 (SIM_AC_OPTION_HARDWARE): Add cfi to default list.
diff --git a/sim/common/hw-alloc.c b/sim/common/hw-alloc.c
index 7244baa..406ffbf 100644
--- a/sim/common/hw-alloc.c
+++ b/sim/common/hw-alloc.c
@@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <stdlib.h>
#endif
-struct hw_alloc_data {
+struct hw_alloc_data
+{
void *alloc;
struct hw_alloc_data *next;
};
diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c
index 4fe3bde..88e493e 100644
--- a/sim/common/hw-base.c
+++ b/sim/common/hw-base.c
@@ -40,7 +40,8 @@
#include "hw-config.h"
-struct hw_base_data {
+struct hw_base_data
+{
int finished_p;
const struct hw_descriptor *descriptor;
hw_delete_callback *to_delete;
@@ -80,14 +81,16 @@ generic_hw_unit_decode (struct hw *bus,
return -1;
unit++;
}
- if (nr_cells < max_nr_cells) {
- /* shift everything to correct position */
- int i;
- for (i = 1; i <= nr_cells; i++)
- phys->cells[max_nr_cells - i] = phys->cells[nr_cells - i];
- for (i = 0; i < (max_nr_cells - nr_cells); i++)
- phys->cells[i] = 0;
- }
+ if (nr_cells < max_nr_cells)
+ {
+ /* shift everything to correct position */
+ int i;
+
+ for (i = 1; i <= nr_cells; i++)
+ phys->cells[max_nr_cells - i] = phys->cells[nr_cells - i];
+ for (i = 0; i < (max_nr_cells - nr_cells); i++)
+ phys->cells[i] = 0;
+ }
phys->nr_cells = max_nr_cells;
return max_nr_cells;
}
@@ -124,10 +127,11 @@ generic_hw_unit_encode (struct hw *bus,
{
for (; i < phys->nr_cells; i++)
{
- if (pos != buf) {
- strcat(pos, ",");
- pos = strchr(pos, '\0');
- }
+ if (pos != buf)
+ {
+ strcat(pos, ",");
+ pos = strchr(pos, '\0');
+ }
if (phys->cells[i] < 10)
sprintf (pos, "%ld", (unsigned long)phys->cells[i]);
else
diff --git a/sim/common/hw-device.h b/sim/common/hw-device.h
index 4bfc991..3240cae 100644
--- a/sim/common/hw-device.h
+++ b/sim/common/hw-device.h
@@ -294,7 +294,8 @@ typedef unsigned (hw_dma_write_buffer_method)
The number of words determined by the number of {address,size}
cells attributes of the device. */
-typedef struct _hw_unit {
+typedef struct _hw_unit
+{
int nr_cells;
unsigned_cell cells[4]; /* unused cells are zero */
} hw_unit;
@@ -399,7 +400,8 @@ extern char *hw_strdup (struct hw *me, const char *str);
*/
-typedef enum {
+typedef enum
+{
hw_ioctl_break, /* unsigned_word requested_break */
hw_ioctl_set_trace, /* void */
hw_ioctl_create_stack, /* unsigned_word *sp, char **argv, char **envp */
@@ -475,7 +477,8 @@ struct hw_instance_data;
/* Finally the hardware device - keep your grubby little mits off of
these internals! :-) */
-struct hw {
+struct hw
+{
/* our relatives */
struct hw *parent_of_hw;
diff --git a/sim/common/hw-events.c b/sim/common/hw-events.c
index a1b9063..544576b 100644
--- a/sim/common/hw-events.c
+++ b/sim/common/hw-events.c
@@ -27,7 +27,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* The hw-events object is implemented using sim-events */
-struct hw_event {
+struct hw_event
+{
void *data;
struct hw *me;
hw_event_callback *callback;
@@ -35,7 +36,8 @@ struct hw_event {
struct hw_event_data *entry;
};
-struct hw_event_data {
+struct hw_event_data
+{
struct hw_event event;
struct hw_event_data *next;
};
diff --git a/sim/common/hw-handles.c b/sim/common/hw-handles.c
index fb1fe49..c8284da 100644
--- a/sim/common/hw-handles.c
+++ b/sim/common/hw-handles.c
@@ -24,7 +24,8 @@
#include "hw-base.h"
-struct hw_handle_mapping {
+struct hw_handle_mapping
+{
cell_word external;
struct hw *phandle;
struct hw_instance *ihandle;
@@ -32,7 +33,8 @@ struct hw_handle_mapping {
};
-struct hw_handle_data {
+struct hw_handle_data
+{
int nr_mappings;
struct hw_handle_mapping *mappings;
};
diff --git a/sim/common/hw-instances.c b/sim/common/hw-instances.c
index 7fe6bed..5498552 100644
--- a/sim/common/hw-instances.c
+++ b/sim/common/hw-instances.c
@@ -26,7 +26,8 @@
#include "sim-io.h"
#include "sim-assert.h"
-struct hw_instance_data {
+struct hw_instance_data
+{
hw_finish_instance_method *to_finish;
struct hw_instance *instances;
};
diff --git a/sim/common/hw-instances.h b/sim/common/hw-instances.h
index becc2c0..7694193 100644
--- a/sim/common/hw-instances.h
+++ b/sim/common/hw-instances.h
@@ -134,7 +134,8 @@ int hw_instance_call_method
/* Finally an instance of a hardware device - keep your grubby little
mits off of these internals! :-) */
-struct hw_instance {
+struct hw_instance
+{
void *data_of_instance;
char *args_of_instance;
diff --git a/sim/common/hw-main.h b/sim/common/hw-main.h
index 0f10bc8..24ab4b8 100644
--- a/sim/common/hw-main.h
+++ b/sim/common/hw-main.h
@@ -39,7 +39,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
typedef void (hw_finish_method)
(struct hw *me);
-struct hw_descriptor {
+struct hw_descriptor
+{
const char *family;
hw_finish_method *to_finish;
};
@@ -55,7 +56,8 @@ void do_hw_attach_regs (struct hw *me);
or a hw_io status code that indicates the reason for the read
failure */
-enum {
+enum
+{
HW_IO_EOF = -1, HW_IO_NOT_READY = -2, /* See: IEEE 1275 */
};
diff --git a/sim/common/hw-ports.c b/sim/common/hw-ports.c
index 7a0503e..1687caf 100644
--- a/sim/common/hw-ports.c
+++ b/sim/common/hw-ports.c
@@ -37,7 +37,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
#include <ctype.h>
-struct hw_port_edge {
+struct hw_port_edge
+{
int my_port;
struct hw *dest;
int dest_port;
@@ -45,13 +46,15 @@ struct hw_port_edge {
object_disposition disposition;
};
-struct hw_port_data {
+struct hw_port_data
+{
hw_port_event_method *to_port_event;
const struct hw_port_descriptor *ports;
struct hw_port_edge *edges;
};
-const struct hw_port_descriptor empty_hw_ports[] = {
+const struct hw_port_descriptor empty_hw_ports[] =
+{
{ NULL, 0, 0, 0 },
};
diff --git a/sim/common/hw-ports.h b/sim/common/hw-ports.h
index d6255d9..91f0246 100644
--- a/sim/common/hw-ports.h
+++ b/sim/common/hw-ports.h
@@ -24,7 +24,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>. */
/* Initialize a port */
-struct hw_port_descriptor {
+struct hw_port_descriptor
+{
const char *name;
int number;
int nr_ports;
diff --git a/sim/common/hw-properties.c b/sim/common/hw-properties.c
index f253ec0..1dc79e2 100644
--- a/sim/common/hw-properties.c
+++ b/sim/common/hw-properties.c
@@ -35,7 +35,8 @@
/* property entries */
-struct hw_property_data {
+struct hw_property_data
+{
struct hw_property_data *next;
struct hw_property *property;
const void *init_array;
diff --git a/sim/common/hw-properties.h b/sim/common/hw-properties.h
index 64b9a74..d318f56 100644
--- a/sim/common/hw-properties.h
+++ b/sim/common/hw-properties.h
@@ -26,7 +26,8 @@
/* The following are valid property types. The property `array' is
for generic untyped data. */
-typedef enum {
+typedef enum
+{
array_property,
boolean_property,
#if 0
@@ -39,7 +40,8 @@ typedef enum {
string_array_property,
} hw_property_type;
-struct hw_property {
+struct hw_property
+{
struct hw *owner;
const char *name;
hw_property_type type;
@@ -129,7 +131,8 @@ int hw_find_boolean_property
#if 0
-typedef struct _ihandle_runtime_property_spec {
+typedef struct _ihandle_runtime_property_spec
+{
const char *full_path;
} ihandle_runtime_property_spec;
@@ -171,7 +174,8 @@ int hw_find_integer_array_property
-typedef struct _range_property_spec {
+typedef struct _range_property_spec
+{
hw_unit child_address;
hw_unit parent_address;
hw_unit size;
@@ -191,7 +195,8 @@ int hw_find_range_array_property
-typedef struct _reg_property_spec {
+typedef struct _reg_property_spec
+{
hw_unit address;
hw_unit size;
} reg_property_spec;
diff --git a/sim/common/hw-tree.c b/sim/common/hw-tree.c
index a09cc8e..99560bf 100644
--- a/sim/common/hw-tree.c
+++ b/sim/common/hw-tree.c
@@ -43,7 +43,8 @@
/* manipulate/lookup device names */
-typedef struct _name_specifier {
+typedef struct _name_specifier
+{
/* components in the full length name */
char *path;
@@ -153,18 +154,20 @@ split_device_specifier (struct hw *current,
/* an interrupt spec */
spec->property = NULL;
}
- else {
- chp = strrchr(spec->path, '/');
- if (chp == NULL)
- {
- spec->property = spec->path;
- spec->path = strchr(spec->property, '\0');
- }
- else {
- *chp = '\0';
- spec->property = chp+1;
+ else
+ {
+ chp = strrchr(spec->path, '/');
+ if (chp == NULL)
+ {
+ spec->property = spec->path;
+ spec->path = strchr(spec->property, '\0');
+ }
+ else
+ {
+ *chp = '\0';
+ spec->property = chp+1;
+ }
}
- }
/* and mark the rest as invalid */
spec->name = NULL;
@@ -700,11 +703,12 @@ parse_string_property (struct hw *current,
pos = 0;
while (*chp != '\0' && *chp != '"')
{
- if (*chp == '\\' && *(chp+1) != '\0') {
- strings[nr_strings][pos] = *(chp+1);
- chp += 2;
- pos++;
- }
+ if (*chp == '\\' && *(chp+1) != '\0')
+ {
+ strings[nr_strings][pos] = *(chp+1);
+ chp += 2;
+ pos++;
+ }
else
{
strings[nr_strings][pos] = *chp;
@@ -982,7 +986,8 @@ hw_tree_traverse (struct hw *root,
-struct printer {
+struct printer
+{
hw_tree_print_callback *print;
void *file;
};
@@ -1006,12 +1011,13 @@ print_size (struct hw *bus,
for (i = 0; i < size->nr_cells; i++)
if (size->cells[i] != 0)
break;
- if (i < size->nr_cells) {
- p->print (p->file, " 0x%lx", (unsigned long) size->cells[i]);
- i++;
- for (; i < size->nr_cells; i++)
- p->print (p->file, ",0x%lx", (unsigned long) size->cells[i]);
- }
+ if (i < size->nr_cells)
+ {
+ p->print (p->file, " 0x%lx", (unsigned long) size->cells[i]);
+ i++;
+ for (; i < size->nr_cells; i++)
+ p->print (p->file, ",0x%lx", (unsigned long) size->cells[i]);
+ }
else
p->print (p->file, " 0");
}
@@ -1025,10 +1031,11 @@ print_reg_property (struct hw *me,
reg_property_spec reg;
for (reg_nr = 0;
hw_find_reg_array_property (me, property->name, reg_nr, &reg);
- reg_nr++) {
- print_address (hw_parent (me), &reg.address, p);
- print_size (me, &reg.size, p);
- }
+ reg_nr++)
+ {
+ print_address (hw_parent (me), &reg.address, p);
+ print_size (me, &reg.size, p);
+ }
}
static void
@@ -1054,20 +1061,22 @@ print_string (struct hw *me,
struct printer *p)
{
p->print (p->file, " \"");
- while (*string != '\0') {
- switch (*string) {
- case '"':
- p->print (p->file, "\\\"");
- break;
- case '\\':
- p->print (p->file, "\\\\");
- break;
- default:
- p->print (p->file, "%c", *string);
- break;
+ while (*string != '\0')
+ {
+ switch (*string)
+ {
+ case '"':
+ p->print (p->file, "\\\"");
+ break;
+ case '\\':
+ p->print (p->file, "\\\\");
+ break;
+ default:
+ p->print (p->file, "%c", *string);
+ break;
+ }
+ string++;
}
- string++;
- }
p->print (p->file, "\"");
}
@@ -1127,10 +1136,11 @@ print_properties (struct hw *me,
{
unsigned8 *w = (unsigned8*)property->array;
p->print (p->file, " [");
- while ((char*)w - (char*)property->array < property->sizeof_array) {
- p->print (p->file, " 0x%2x", BE2H_1 (*w));
- w++;
- }
+ while ((char*)w - (char*)property->array < property->sizeof_array)
+ {
+ p->print (p->file, " 0x%2x", BE2H_1 (*w));
+ w++;
+ }
}
break;
}