From: Mike Frysinger Date: Wed, 11 May 2011 20:02:42 +0000 (+0000) Subject: sim: fix func call style (space before paren) X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=34b47c3828ca8e6d9dcddb2886744fb470e4276c;hp=1f84b6196ba7218766be02547881a5c2165be3ae;p=deliverable%2Fbinutils-gdb.git sim: fix func call style (space before paren) Committed this as obvious: -foo(...); +foo (...); Signed-off-by: Mike Frysinger --- diff --git a/sim/common/ChangeLog b/sim/common/ChangeLog index 25e758ba7b..7db35bcfb1 100644 --- a/sim/common/ChangeLog +++ b/sim/common/ChangeLog @@ -1,3 +1,12 @@ +2011-05-11 Mike Frysinger + + * callback.c, dv-pal.c, dv-sockser.c, hw-base.c, hw-device.c, + hw-instances.c, hw-ports.c, hw-properties.c, hw-tree.c, sim-abort.c, + sim-arange.c, sim-config.c, sim-core.c, sim-engine.c, sim-events.c, + sim-hw.c, sim-io.c, sim-memopt.c, sim-options.c, sim-profile.c, + sim-resume.c, sim-stop.c, syscall.c: Add space before parenthesis + around function arguments. + 2011-04-14 Mike Frysinger * sim-options.c (complete_option_list, sim_complete_command): diff --git a/sim/common/callback.c b/sim/common/callback.c index 9bc80197b0..a8f344e6f9 100644 --- a/sim/common/callback.c +++ b/sim/common/callback.c @@ -231,7 +231,7 @@ os_poll_quit (p) #endif #if defined (_MSC_VER) /* NB - this will not compile! */ - int k = win32pollquit(); + int k = win32pollquit (); if (k == 1) return 1; else if (k == 2) diff --git a/sim/common/dv-pal.c b/sim/common/dv-pal.c index c831d0ad32..4d49587f7c 100644 --- a/sim/common/dv-pal.c +++ b/sim/common/dv-pal.c @@ -306,7 +306,7 @@ scan_hw_pal (struct hw *me) hw_pal_device *hw_pal = (hw_pal_device *)hw_data (me); char c; int count; - count = do_hw_poll_read (me, hw_pal->reader, 0/*STDIN*/, &c, sizeof(c)); + count = do_hw_poll_read (me, hw_pal->reader, 0/*STDIN*/, &c, sizeof (c)); switch (count) { case HW_IO_NOT_READY: @@ -482,7 +482,7 @@ hw_pal_io_write_buffer (struct hw *me, #if NOT_YET static void -hw_pal_instance_delete_callback(hw_instance *instance) +hw_pal_instance_delete_callback (hw_instance *instance) { /* nothing to delete, the hw_pal is attached to the struct hw */ return; diff --git a/sim/common/dv-sockser.c b/sim/common/dv-sockser.c index ef249e6b3e..ae65585460 100644 --- a/sim/common/dv-sockser.c +++ b/sim/common/dv-sockser.c @@ -175,12 +175,12 @@ dv_sockser_init (SIM_DESC sd) } sockaddr.sin_family = PF_INET; - sockaddr.sin_port = htons(port); + sockaddr.sin_port = htons (port); memcpy (&sockaddr.sin_addr.s_addr, hostent->h_addr, sizeof (struct in_addr)); tmp = 1; - if (setsockopt (sockser_listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)& tmp, sizeof(tmp)) < 0) + if (setsockopt (sockser_listen_fd, SOL_SOCKET, SO_REUSEADDR, (void*)& tmp, sizeof (tmp)) < 0) { sim_io_eprintf (sd, "sockser init: unable to set SO_REUSEADDR: %s\n", strerror (errno)); diff --git a/sim/common/hw-base.c b/sim/common/hw-base.c index 88e493e7dd..97e92c821b 100644 --- a/sim/common/hw-base.c +++ b/sim/common/hw-base.c @@ -114,13 +114,13 @@ generic_hw_unit_encode (struct hw *bus, /* don't output anything if empty */ if (phys->nr_cells == 0) { - strcpy(pos, ""); + strcpy (pos, ""); len = 0; } else if (i == phys->nr_cells) { /* all zero */ - strcpy(pos, "0"); + strcpy (pos, "0"); len = 1; } else @@ -129,14 +129,14 @@ generic_hw_unit_encode (struct hw *bus, { if (pos != buf) { - strcat(pos, ","); - pos = strchr(pos, '\0'); + strcat (pos, ","); + pos = strchr (pos, '\0'); } if (phys->cells[i] < 10) sprintf (pos, "%ld", (unsigned long)phys->cells[i]); else sprintf (pos, "0x%lx", (unsigned long)phys->cells[i]); - pos = strchr(pos, '\0'); + pos = strchr (pos, '\0'); } len = pos - buf; } diff --git a/sim/common/hw-device.c b/sim/common/hw-device.c index a5dff43d15..66b2225d28 100644 --- a/sim/common/hw-device.c +++ b/sim/common/hw-device.c @@ -45,9 +45,9 @@ hw_ioctl (struct hw *me, { int status; va_list ap; - va_start(ap, request); + va_start (ap, request); status = me->to_ioctl (me, request, ap); - va_end(ap); + va_end (ap); return status; } diff --git a/sim/common/hw-instances.c b/sim/common/hw-instances.c index 5498552b8c..f7d177becb 100644 --- a/sim/common/hw-instances.c +++ b/sim/common/hw-instances.c @@ -87,7 +87,7 @@ hw_instance_delete (struct hw_instance *instance) struct hw *me = hw_instance_hw (instance); if (instance->to_instance_delete == NULL) hw_abort (me, "no delete method"); - instance->method->delete(instance); + instance->method->delete (instance); if (instance->args != NULL) free (instance->args); if (instance->path != NULL) @@ -109,7 +109,7 @@ hw_instance_delete (struct hw_instance *instance) struct hw_instance *curr = me->instances; while (curr != NULL) { - ASSERT(curr != instance); + ASSERT (curr != instance); curr = curr->next; } /* unlink the child */ @@ -173,7 +173,7 @@ hw_instance_call_method (struct hw_instance *instance, } while (method->name != NULL) { - if (strcmp(method->name, method_name) == 0) + if (strcmp (method->name, method_name) == 0) { return method->method (instance, n_stack_args, stack_args, @@ -280,8 +280,8 @@ hw_instance_interceed (struct hw_instance *parent, *previous = instance; } instance->data = data; - instance->args = (args == NULL ? NULL : (char *) strdup(args)); - instance->path = (path == NULL ? NULL : (char *) strdup(path)); + instance->args = (args == NULL ? NULL : (char *) strdup (args)); + instance->path = (path == NULL ? NULL : (char *) strdup (path)); cap_add (instance->owner->ihandles, instance); return instance; #endif diff --git a/sim/common/hw-ports.c b/sim/common/hw-ports.c index 1687caf7be..78215a81ba 100644 --- a/sim/common/hw-ports.c +++ b/sim/common/hw-ports.c @@ -246,7 +246,7 @@ hw_port_decode (struct hw *me, { if (port_name == NULL || port_name[0] == '\0') return 0; - if (isdigit(port_name[0])) + if (isdigit (port_name[0])) { return strtoul (port_name, NULL, 0); } @@ -268,7 +268,7 @@ hw_port_decode (struct hw *me, { if (port_name[len] == '\0') return ports->number; - else if(isdigit (port_name[len])) + else if (isdigit (port_name[len])) { int port = (ports->number + strtoul (&port_name[len], NULL, 0)); @@ -313,7 +313,7 @@ hw_port_encode (struct hw *me, && port_number < ports->number + ports->nr_ports) { strcpy (buf, ports->name); - sprintf (buf + strlen(buf), "%d", port_number - ports->number); + sprintf (buf + strlen (buf), "%d", port_number - ports->number); if (strlen (buf) >= sizeof_buf) hw_abort (me, "hw_port_encode: buffer overflow"); return strlen (buf); @@ -323,10 +323,10 @@ hw_port_encode (struct hw *me, { if (ports->number == port_number) { - if (strlen(ports->name) >= sizeof_buf) + if (strlen (ports->name) >= sizeof_buf) hw_abort (me, "hw_port_encode: buffer overflow"); - strcpy(buf, ports->name); - return strlen(buf); + strcpy (buf, ports->name); + return strlen (buf); } } } @@ -334,7 +334,7 @@ hw_port_encode (struct hw *me, } } sprintf (buf, "%d", port_number); - if (strlen(buf) >= sizeof_buf) + if (strlen (buf) >= sizeof_buf) hw_abort (me, "hw_port_encode: buffer overflow"); - return strlen(buf); + return strlen (buf); } diff --git a/sim/common/hw-properties.c b/sim/common/hw-properties.c index 1dc79e27c2..c20b474719 100644 --- a/sim/common/hw-properties.c +++ b/sim/common/hw-properties.c @@ -211,7 +211,7 @@ hw_init_static_properties (SIM_DESC sd, { ASSERT (property->init_array != NULL); ASSERT (property->property->array == NULL); - ASSERT(property->property->disposition == permenant_object); + ASSERT (property->property->disposition == permenant_object); switch (property->property->type) { case array_property: @@ -373,8 +373,8 @@ hw_add_boolean_property (struct hw *me, { signed32 new_boolean = (boolean ? -1 : 0); hw_add_property (me, property, boolean_property, - &new_boolean, sizeof(new_boolean), - &new_boolean, sizeof(new_boolean), + &new_boolean, sizeof (new_boolean), + &new_boolean, sizeof (new_boolean), NULL, permenant_object); } @@ -404,7 +404,7 @@ hw_add_ihandle_runtime_property (struct hw *me, { /* enter the full path as the init array */ hw_add_property (me, property, ihandle_property, - ihandle->full_path, strlen(ihandle->full_path) + 1, + ihandle->full_path, strlen (ihandle->full_path) + 1, NULL, 0, NULL, permenant_object); } @@ -458,13 +458,13 @@ hw_find_ihandle_property (struct hw *me, if (node == NULL) hw_abort (me, "property \"%s\" not found", property); if (node->type != ihandle_property) - hw_abort(me, "property \"%s\" of wrong type (ihandle)", property); + hw_abort (me, "property \"%s\" of wrong type (ihandle)", property); if (node->array == NULL) - hw_abort(me, "runtime property \"%s\" not yet initialized", property); + hw_abort (me, "runtime property \"%s\" not yet initialized", property); - ASSERT (sizeof(ihandle) == node->sizeof_array); - memcpy (&ihandle, node->array, sizeof(ihandle)); - instance = external_to_hw_instance (me, BE2H_cell(ihandle)); + ASSERT (sizeof (ihandle) == node->sizeof_array); + memcpy (&ihandle, node->array, sizeof (ihandle)); + instance = external_to_hw_instance (me, BE2H_cell (ihandle)); ASSERT (instance != NULL); return instance; } @@ -478,8 +478,8 @@ hw_add_integer_property (struct hw *me, { H2BE (integer); hw_add_property (me, property, integer_property, - &integer, sizeof(integer), - &integer, sizeof(integer), + &integer, sizeof (integer), + &integer, sizeof (integer), NULL, permenant_object); } @@ -495,7 +495,7 @@ hw_find_integer_property (struct hw *me, hw_abort (me, "property \"%s\" not found", property); if (node->type != integer_property) hw_abort (me, "property \"%s\" of wrong type (integer)", property); - ASSERT (sizeof(integer) == node->sizeof_array); + ASSERT (sizeof (integer) == node->sizeof_array); memcpy (&integer, node->array, sizeof (integer)); return BE2H_cell (integer); } @@ -537,7 +537,7 @@ unit_address_to_cells (const hw_unit *unit, int nr_cells) { int i; - ASSERT(nr_cells == unit->nr_cells); + ASSERT (nr_cells == unit->nr_cells); for (i = 0; i < unit->nr_cells; i++) { *cell = H2BE_cell (unit->cells[i]); @@ -553,7 +553,7 @@ cells_to_unit_address (const unsigned_cell *cell, int nr_cells) { int i; - memset(unit, 0, sizeof(*unit)); + memset (unit, 0, sizeof (*unit)); unit->nr_cells = nr_cells; for (i = 0; i < unit->nr_cells; i++) { @@ -662,8 +662,8 @@ static unsigned nr_reg_property_cells (struct hw *me, int nr_regs) { - return (hw_unit_nr_address_cells (hw_parent(me)) - + hw_unit_nr_size_cells (hw_parent(me)) + return (hw_unit_nr_address_cells (hw_parent (me)) + + hw_unit_nr_size_cells (hw_parent (me)) ) * nr_regs; } @@ -750,8 +750,8 @@ hw_add_string_property (struct hw *me, const char *string) { hw_add_property (me, property, string_property, - string, strlen(string) + 1, - string, strlen(string) + 1, + string, strlen (string) + 1, + string, strlen (string) + 1, NULL, permenant_object); } @@ -767,7 +767,7 @@ hw_find_string_property (struct hw *me, if (node->type != string_property) hw_abort (me, "property \"%s\" of wrong type (string)", property); string = node->array; - ASSERT (strlen(string) + 1 == node->sizeof_array); + ASSERT (strlen (string) + 1 == node->sizeof_array); return string; } @@ -827,7 +827,7 @@ hw_find_string_array_property (struct hw *me, if (index == 0) { *string = node->array; - ASSERT (strlen(*string) + 1 == node->sizeof_array); + ASSERT (strlen (*string) + 1 == node->sizeof_array); return 1; } break; @@ -887,7 +887,7 @@ hw_add_duplicate_property (struct hw *me, while (master->property != original) { master = master->next; - ASSERT(master != NULL); + ASSERT (master != NULL); } /* now duplicate it */ hw_add_property (me, property, diff --git a/sim/common/hw-tree.c b/sim/common/hw-tree.c index 99560bf320..757099ee8e 100644 --- a/sim/common/hw-tree.c +++ b/sim/common/hw-tree.c @@ -96,14 +96,14 @@ split_device_specifier (struct hw *current, { alias[len] = device_specifier[len]; len++; - if (len >= sizeof(alias)) + if (len >= sizeof (alias)) hw_abort (NULL, "split_device_specifier: buffer overflow"); } alias[len] = '\0'; if (aliases != NULL && hw_find_property (aliases, alias)) { - strcpy (spec->buf, hw_find_string_property(aliases, alias)); + strcpy (spec->buf, hw_find_string_property (aliases, alias)); strcat (spec->buf, device_specifier + len); } else @@ -113,23 +113,23 @@ split_device_specifier (struct hw *current, } else { - strcpy(spec->buf, device_specifier); + strcpy (spec->buf, device_specifier); } /* check no overflow */ - if (strlen(spec->buf) >= sizeof(spec->buf)) + if (strlen (spec->buf) >= sizeof (spec->buf)) hw_abort (NULL, "split_device_specifier: buffer overflow\n"); /* strip leading spaces */ chp = spec->buf; - while (*chp != '\0' && isspace(*chp)) + while (*chp != '\0' && isspace (*chp)) chp++; if (*chp == '\0') return 0; /* find the path and terminate it with null */ spec->path = chp; - while (*chp != '\0' && !isspace(*chp)) + while (*chp != '\0' && !isspace (*chp)) chp++; if (*chp != '\0') { @@ -138,7 +138,7 @@ split_device_specifier (struct hw *current, } /* and any value */ - while (*chp != '\0' && isspace(*chp)) + while (*chp != '\0' && isspace (*chp)) chp++; spec->value = chp; @@ -156,11 +156,11 @@ split_device_specifier (struct hw *current, } else { - chp = strrchr(spec->path, '/'); + chp = strrchr (spec->path, '/'); if (chp == NULL) { spec->property = spec->path; - spec->path = strchr(spec->property, '\0'); + spec->path = strchr (spec->property, '\0'); } else { @@ -250,7 +250,7 @@ split_device_name (name_specifier *spec) /* break out the base */ if (spec->name[0] == '(') { - chp = strchr(spec->name, ')'); + chp = strchr (spec->name, ')'); if (chp == NULL) { spec->family = spec->name; @@ -267,7 +267,7 @@ split_device_name (name_specifier *spec) spec->family = spec->name; } /* now break out the unit */ - chp = strchr(spec->name, '@'); + chp = strchr (spec->name, '@'); if (chp == NULL) { spec->unit = NULL; @@ -280,7 +280,7 @@ split_device_name (name_specifier *spec) spec->unit = chp; } /* finally any args */ - chp = strchr(chp, ':'); + chp = strchr (chp, ':'); if (chp == NULL) spec->args = NULL; else @@ -442,11 +442,11 @@ split_fill_path (struct hw *current, /* */ static const char * -skip_token(const char *chp) +skip_token (const char *chp) { - while (!isspace(*chp) && *chp != '\0') + while (!isspace (*chp) && *chp != '\0') chp++; - while (isspace(*chp) && *chp != '\0') + while (isspace (*chp) && *chp != '\0') chp++; return chp; } @@ -502,7 +502,7 @@ parse_size (struct hw *current, int i; int nr; const char *curr = chp; - memset(size, 0, sizeof(*size)); + memset (size, 0, sizeof (*size)); /* parse the numeric list */ size->nr_cells = hw_unit_nr_size_cells (bus); nr = 0; @@ -554,9 +554,9 @@ parse_reg_property (struct hw *current, chp = property_value; for (reg_nr = 0; reg_nr < nr_regs; reg_nr++) { - chp = parse_address (current, hw_parent(current), + chp = parse_address (current, hw_parent (current), chp, ®s[reg_nr].address); - chp = parse_size (current, hw_parent(current), + chp = parse_size (current, hw_parent (current), chp, ®s[reg_nr].size); } @@ -584,7 +584,7 @@ parse_ranges_property (struct hw *current, nr_ranges = count_entries (current, property_name, property_value, 3); /* create a property of that size */ - ranges = zalloc (nr_ranges * sizeof(*ranges)); + ranges = zalloc (nr_ranges * sizeof (*ranges)); /* fill it in */ chp = property_value; @@ -592,7 +592,7 @@ parse_ranges_property (struct hw *current, { chp = parse_address (current, current, chp, &ranges[range_nr].child_address); - chp = parse_address (current, hw_parent(current), + chp = parse_address (current, hw_parent (current), chp, &ranges[range_nr].parent_address); chp = parse_size (current, current, chp, &ranges[range_nr].size); @@ -641,7 +641,7 @@ parse_integer_property (struct hw *current, } /* perhaps integer array property is better */ hw_add_array_property (current, property_name, words, - sizeof(words[0]) * nr_entries); + sizeof (words[0]) * nr_entries); } } @@ -669,7 +669,7 @@ parse_string_property (struct hw *current, approx_nr_strings = (approx_nr_strings) / 2; /* create a string buffer for that many (plus a null) */ - strings = (char**) zalloc ((approx_nr_strings + 1) * sizeof(char*)); + strings = (char**) zalloc ((approx_nr_strings + 1) * sizeof (char*)); /* now find all the strings */ chp = property_value; @@ -724,10 +724,10 @@ parse_string_property (struct hw *current, { /* copy over a single unquoted token */ int len = 0; - while (chp[len] != '\0' && !isspace(chp[len])) + while (chp[len] != '\0' && !isspace (chp[len])) len++; - strings[nr_strings] = zalloc(len + 1); - strncpy(strings[nr_strings], chp, len); + strings[nr_strings] = zalloc (len + 1); + strncpy (strings[nr_strings], chp, len); strings[nr_strings][len] = '\0'; chp += len; } @@ -756,7 +756,7 @@ parse_string_property (struct hw *current, nr_strings--; free (strings[nr_strings]); } - free(strings); + free (strings); } @@ -901,7 +901,7 @@ hw_tree_vparse (struct hw *current, nr_words += 1; } hw_add_array_property (current, spec.property, - words, sizeof(words[0]) * nr_words); + words, sizeof (words[0]) * nr_words); break; } case '"': @@ -932,14 +932,14 @@ hw_tree_vparse (struct hw *current, { parse_ranges_property (current, spec.property, spec.value); } - else if (isdigit(spec.value[0]) - || (spec.value[0] == '-' && isdigit(spec.value[1])) - || (spec.value[0] == '+' && isdigit(spec.value[1]))) + else if (isdigit (spec.value[0]) + || (spec.value[0] == '-' && isdigit (spec.value[1])) + || (spec.value[0] == '+' && isdigit (spec.value[1]))) { - parse_integer_property(current, spec.property, spec.value); + parse_integer_property (current, spec.property, spec.value); } else - parse_string_property(current, spec.property, spec.value); + parse_string_property (current, spec.property, spec.value); break; } } @@ -998,7 +998,7 @@ print_address (struct hw *bus, struct printer *p) { char unit[32]; - hw_unit_encode (bus, phys, unit, sizeof(unit)); + hw_unit_encode (bus, phys, unit, sizeof (unit)); p->print (p->file, " %s", unit); } @@ -1146,7 +1146,7 @@ print_properties (struct hw *me, } case boolean_property: { - int b = hw_find_boolean_property(me, property->name); + int b = hw_find_boolean_property (me, property->name); p->print (p->file, " %s", b ? "true" : "false"); break; } @@ -1156,7 +1156,7 @@ print_properties (struct hw *me, if (property->array != NULL) { device_instance *instance = hw_find_ihandle_property (me, property->name); - p->print (p->file, " *%s", device_instance_path(instance)); + p->print (p->file, " *%s", device_instance_path (instance)); } else { @@ -1211,8 +1211,8 @@ print_interrupts (struct hw *me, struct printer *p = data; char src[32]; char dst[32]; - hw_port_encode (me, my_port, src, sizeof(src), output_port); - hw_port_encode (dest, dest_port, dst, sizeof(dst), input_port); + hw_port_encode (me, my_port, src, sizeof (src), output_port); + hw_port_encode (dest, dest_port, dst, sizeof (dst), input_port); p->print (p->file, "%s > %s %s %s\n", hw_path (me), @@ -1247,19 +1247,19 @@ hw_tree_print (struct hw *root, #if NOT_YET device_instance * -tree_instance(struct hw *root, - const char *device_specifier) +tree_instance (struct hw *root, + const char *device_specifier) { /* find the device node */ struct hw *me; name_specifier spec; - if (!split_device_specifier(root, device_specifier, &spec)) + if (!split_device_specifier (root, device_specifier, &spec)) return NULL; - me = split_find_device(root, &spec); + me = split_find_device (root, &spec); if (spec.name != NULL) return NULL; /* create the instance */ - return device_create_instance(me, device_specifier, spec.last_args); + return device_create_instance (me, device_specifier, spec.last_args); } #endif diff --git a/sim/common/sim-abort.c b/sim/common/sim-abort.c index 8cc1342d6e..1a6ab8431f 100644 --- a/sim/common/sim-abort.c +++ b/sim/common/sim-abort.c @@ -43,17 +43,17 @@ sim_engine_abort (SIM_DESC sd, if (sd != NULL) { va_list ap; - va_start(ap, fmt); + va_start (ap, fmt); sim_io_evprintf (sd, fmt, ap); - va_end(ap); + va_end (ap); sim_io_error (sd, "\n"); } else { va_list ap; - va_start(ap, fmt); + va_start (ap, fmt); vfprintf (stderr, fmt, ap); - va_end(ap); + va_end (ap); fprintf (stderr, "\n"); abort (); } diff --git a/sim/common/sim-arange.c b/sim/common/sim-arange.c index 799e085908..b73eb211ea 100644 --- a/sim/common/sim-arange.c +++ b/sim/common/sim-arange.c @@ -194,9 +194,9 @@ frob_range (ADDR_RANGE *ar, address_word start, address_word end, int delete_p) out: if (new_asr) - free(new_asr); + free (new_asr); if (new_asr2) - free(new_asr2); + free (new_asr2); } /* Free T and all subtrees. */ diff --git a/sim/common/sim-config.c b/sim/common/sim-config.c index cb44d23c2b..32eed31712 100644 --- a/sim/common/sim-config.c +++ b/sim/common/sim-config.c @@ -151,7 +151,7 @@ sim_config (SIM_DESC sd) && !bfd_big_endian (STATE_PROG_BFD (sd)))) prefered_target_byte_order = 0; else - prefered_target_byte_order = (bfd_little_endian(STATE_PROG_BFD (sd)) + prefered_target_byte_order = (bfd_little_endian (STATE_PROG_BFD (sd)) ? LITTLE_ENDIAN : BIG_ENDIAN); @@ -241,15 +241,15 @@ sim_config (SIM_DESC sd) if (STATE_ENVIRONMENT (sd) == ALL_ENVIRONMENT) { const char *env = - tree_find_string_property(root, "/openprom/options/env"); - STATE_ENVIRONMENT (sd) = ((strcmp(env, "user") == 0 - || strcmp(env, "uea") == 0) + tree_find_string_property (root, "/openprom/options/env"); + STATE_ENVIRONMENT (sd) = ((strcmp (env, "user") == 0 + || strcmp (env, "uea") == 0) ? USER_ENVIRONMENT - : (strcmp(env, "virtual") == 0 - || strcmp(env, "vea") == 0) + : (strcmp (env, "virtual") == 0 + || strcmp (env, "vea") == 0) ? VIRTUAL_ENVIRONMENT - : (strcmp(env, "operating") == 0 - || strcmp(env, "oea") == 0) + : (strcmp (env, "operating") == 0 + || strcmp (env, "oea") == 0) ? OPERATING_ENVIRONMENT : ALL_ENVIRONMENT); } @@ -262,7 +262,7 @@ sim_config (SIM_DESC sd) #if (WITH_TREE_PROPERTIES) if (current_alignment == 0) current_alignment = - (tree_find_boolean_property(root, "/openprom/options/strict-alignment?") + (tree_find_boolean_property (root, "/openprom/options/strict-alignment?") ? STRICT_ALIGNMENT : NONSTRICT_ALIGNMENT); #endif diff --git a/sim/common/sim-core.c b/sim/common/sim-core.c index d50d98dca9..0ae5d7475b 100644 --- a/sim/common/sim-core.c +++ b/sim/common/sim-core.c @@ -65,7 +65,7 @@ sim_core_install (SIM_DESC sd) static void sim_core_uninstall (SIM_DESC sd) { - sim_core *core = STATE_CORE(sd); + sim_core *core = STATE_CORE (sd); unsigned map; /* blow away any mappings */ for (map = 0; map < nr_maps; map++) { @@ -74,10 +74,10 @@ sim_core_uninstall (SIM_DESC sd) sim_core_mapping *tbd = curr; curr = curr->next; if (tbd->free_buffer != NULL) { - SIM_ASSERT(tbd->buffer != NULL); - free(tbd->free_buffer); + SIM_ASSERT (tbd->buffer != NULL); + free (tbd->free_buffer); } - free(tbd); + free (tbd); } core->common.map[map].first = NULL; } @@ -150,7 +150,7 @@ new_sim_core_mapping (SIM_DESC sd, void *buffer, void *free_buffer) { - sim_core_mapping *new_mapping = ZALLOC(sim_core_mapping); + sim_core_mapping *new_mapping = ZALLOC (sim_core_mapping); /* common */ new_mapping->level = level; new_mapping->space = space; @@ -198,7 +198,7 @@ sim_core_map_attach (SIM_DESC sd, if (nr_bytes == 0) { #if (WITH_DEVICES) - device_error(client, "called on sim_core_map_attach with size zero"); + device_error (client, "called on sim_core_map_attach with size zero"); #endif #if (WITH_HW) sim_hw_abort (sd, client, "called on sim_core_map_attach with size zero"); @@ -209,7 +209,7 @@ sim_core_map_attach (SIM_DESC sd, /* find the insertion point (between last/next) */ next_mapping = access_map->first; last_mapping = &access_map->first; - while(next_mapping != NULL + while (next_mapping != NULL && (next_mapping->level < level || (next_mapping->level == level && next_mapping->bound < addr))) @@ -260,10 +260,10 @@ sim_core_map_attach (SIM_DESC sd, } /* create/insert the new mapping */ - *last_mapping = new_sim_core_mapping(sd, - level, - space, addr, nr_bytes, modulo, - client, buffer, free_buffer); + *last_mapping = new_sim_core_mapping (sd, + level, + space, addr, nr_bytes, modulo, + client, buffer, free_buffer); (*last_mapping)->next = next_mapping; } #endif @@ -289,7 +289,7 @@ sim_core_attach (SIM_DESC sd, #endif void *optional_buffer) { - sim_core *memory = STATE_CORE(sd); + sim_core *memory = STATE_CORE (sd); unsigned map; void *buffer; void *free_buffer; @@ -463,14 +463,14 @@ sim_core_detach (SIM_DESC sd, STATIC_INLINE_SIM_CORE\ (sim_core_mapping *) -sim_core_find_mapping(sim_core_common *core, - unsigned map, - address_word addr, - unsigned nr_bytes, - transfer_type transfer, - int abort, /*either 0 or 1 - hint to inline/-O */ - sim_cpu *cpu, /* abort => cpu != NULL */ - sim_cia cia) +sim_core_find_mapping (sim_core_common *core, + unsigned map, + address_word addr, + unsigned nr_bytes, + transfer_type transfer, + int abort, /*either 0 or 1 - hint to inline/-O */ + sim_cpu *cpu, /* abort => cpu != NULL */ + sim_cia cia) { sim_core_mapping *mapping = core->map[map].first; ASSERT ((addr & (nr_bytes - 1)) == 0); /* must be aligned */ @@ -564,7 +564,7 @@ sim_core_read_buffer (SIM_DESC sd, } #endif ((unsigned_1*)buffer)[count] = - *(unsigned_1*)sim_core_translate(mapping, raddr); + *(unsigned_1*)sim_core_translate (mapping, raddr); count += 1; } return count; @@ -631,7 +631,7 @@ sim_core_write_buffer (SIM_DESC sd, continue; } #endif - *(unsigned_1*)sim_core_translate(mapping, raddr) = + *(unsigned_1*)sim_core_translate (mapping, raddr) = ((unsigned_1*)buffer)[count]; count += 1; } @@ -817,7 +817,7 @@ sim_core_trans_addr (SIM_DESC sd, 0 /*dont-abort*/, NULL, NULL_CIA); if (mapping == NULL) return NULL; - return sim_core_translate(mapping, addr); + return sim_core_translate (mapping, addr); } #endif diff --git a/sim/common/sim-engine.c b/sim/common/sim-engine.c index 32820c158e..2344da1f2f 100644 --- a/sim/common/sim-engine.c +++ b/sim/common/sim-engine.c @@ -149,7 +149,7 @@ sim_engine_abort (SIM_DESC sd, { va_list ap; ASSERT (sd == NULL || STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); - va_start(ap, fmt); + va_start (ap, fmt); sim_engine_vabort (sd, cpu, cia, fmt, ap); va_end (ap); } diff --git a/sim/common/sim-events.c b/sim/common/sim-events.c index 804d6c6758..444fbe5f49 100644 --- a/sim/common/sim-events.c +++ b/sim/common/sim-events.c @@ -279,7 +279,7 @@ sim_events_zalloc (SIM_DESC sd) /*-LOCK-*/ sigset_t old_mask; sigset_t new_mask; - sigfillset(&new_mask); + sigfillset (&new_mask); sigprocmask (SIG_SETMASK, &new_mask, &old_mask); #endif new = ZALLOC (sim_event); @@ -523,16 +523,16 @@ sim_events_schedule_vtracef (SIM_DESC sd, new_event->watching = watch_timer; if (fmt == NULL || !ETRACE_P || vasprintf (&new_event->trace, fmt, ap) < 0) new_event->trace = NULL; - insert_sim_event(sd, new_event, delta_time); - ETRACE((_ETRACE, - "event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n", - (long)sim_events_time(sd), - (long)new_event, - (long)new_event->time_of_event, - (long)new_event->handler, - (long)new_event->data, - (new_event->trace != NULL) ? ", " : "", - (new_event->trace != NULL) ? new_event->trace : "")); + insert_sim_event (sd, new_event, delta_time); + ETRACE ((_ETRACE, + "event scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx%s%s\n", + (long)sim_events_time (sd), + (long)new_event, + (long)new_event->time_of_event, + (long)new_event->handler, + (long)new_event->data, + (new_event->trace != NULL) ? ", " : "", + (new_event->trace != NULL) ? new_event->trace : "")); return new_event; } #endif @@ -551,7 +551,7 @@ sim_events_schedule_after_signal (SIM_DESC sd, /*-LOCK-*/ sigset_t old_mask; sigset_t new_mask; - sigfillset(&new_mask); + sigfillset (&new_mask); sigprocmask (SIG_SETMASK, &new_mask, &old_mask); #endif @@ -578,7 +578,7 @@ sim_events_schedule_after_signal (SIM_DESC sd, ETRACE ((_ETRACE, "signal scheduled at %ld - tag 0x%lx - time %ld, handler 0x%lx, data 0x%lx\n", - (long)sim_events_time(sd), + (long)sim_events_time (sd), (long)new_event, (long)new_event->time_of_event, (long)new_event->handler, @@ -1069,7 +1069,7 @@ sim_events_preprocess (SIM_DESC sd, int events_were_last, int events_were_next) { - sim_events *events = STATE_EVENTS(sd); + sim_events *events = STATE_EVENTS (sd); if (events_were_last) { /* Halted part way through event processing */ @@ -1092,8 +1092,8 @@ INLINE_SIM_EVENTS\ (void) sim_events_process (SIM_DESC sd) { - sim_events *events = STATE_EVENTS(sd); - signed64 event_time = sim_events_time(sd); + sim_events *events = STATE_EVENTS (sd); + signed64 event_time = sim_events_time (sd); /* Clear work_pending before checking nr_held. Clearing work_pending after nr_held (with out a lock could loose an @@ -1110,8 +1110,8 @@ sim_events_process (SIM_DESC sd) /*-LOCK-*/ sigset_t old_mask; sigset_t new_mask; - sigfillset(&new_mask); - sigprocmask(SIG_SETMASK, &new_mask, &old_mask); + sigfillset (&new_mask); + sigprocmask (SIG_SETMASK, &new_mask, &old_mask); #endif for (i = 0; i < events->nr_held; i++) @@ -1126,7 +1126,7 @@ sim_events_process (SIM_DESC sd) #if defined(HAVE_SIGPROCMASK) && defined(SIG_SETMASK) /*-UNLOCK-*/ - sigprocmask(SIG_SETMASK, &old_mask, NULL); + sigprocmask (SIG_SETMASK, &old_mask, NULL); #endif } @@ -1145,14 +1145,14 @@ sim_events_process (SIM_DESC sd) { sim_event_handler *handler = to_do->handler; void *data = to_do->data; - ETRACE((_ETRACE, - "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n", - (long) event_time, - (long) to_do, - (long) handler, - (long) data, - (to_do->trace != NULL) ? ", " : "", - (to_do->trace != NULL) ? to_do->trace : "")); + ETRACE ((_ETRACE, + "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n", + (long) event_time, + (long) to_do, + (long) handler, + (long) data, + (to_do->trace != NULL) ? ", " : "", + (to_do->trace != NULL) ? to_do->trace : "")); sim_events_free (sd, to_do); handler (sd, data); } @@ -1173,14 +1173,14 @@ sim_events_process (SIM_DESC sd) void *data = to_do->data; events->queue = to_do->next; update_time_from_event (sd); - ETRACE((_ETRACE, - "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n", - (long) event_time, - (long) to_do, - (long) handler, - (long) data, - (to_do->trace != NULL) ? ", " : "", - (to_do->trace != NULL) ? to_do->trace : "")); + ETRACE ((_ETRACE, + "event issued at %ld - tag 0x%lx - handler 0x%lx, data 0x%lx%s%s\n", + (long) event_time, + (long) to_do, + (long) handler, + (long) data, + (to_do->trace != NULL) ? ", " : "", + (to_do->trace != NULL) ? to_do->trace : "")); sim_events_free (sd, to_do); handler (sd, data); } diff --git a/sim/common/sim-hw.c b/sim/common/sim-hw.c index 89fe45e269..1000aaede6 100644 --- a/sim/common/sim-hw.c +++ b/sim/common/sim-hw.c @@ -160,7 +160,7 @@ merge_device_file (struct sim_state *sd, } line_nr = 0; - while (fgets (device_path, sizeof(device_path), description)) + while (fgets (device_path, sizeof (device_path), description)) { char *device; /* check that a complete line was read */ @@ -195,13 +195,13 @@ merge_device_file (struct sim_state *sd, sim_io_eprintf (sd, "%s:%d: unexpected eof", file_name, line_nr); return SIM_RC_FAIL; } - if (strchr(device_path, '\n') == NULL) + if (strchr (device_path, '\n') == NULL) { - fclose(description); + fclose (description); sim_io_eprintf (sd, "%s:%d: line to long", file_name, line_nr); return SIM_RC_FAIL; } - *strchr(device_path, '\n') = '\0'; + *strchr (device_path, '\n') = '\0'; line_nr++; } /* parse this line */ diff --git a/sim/common/sim-io.c b/sim/common/sim-io.c index 250f37d6ef..38e2d82e3b 100644 --- a/sim/common/sim-io.c +++ b/sim/common/sim-io.c @@ -45,55 +45,55 @@ static int poll_quit_count = POLL_QUIT_INTERVAL; int -sim_io_init(SIM_DESC sd) +sim_io_init (SIM_DESC sd) { return STATE_CALLBACK (sd)->init (STATE_CALLBACK (sd)); } int -sim_io_shutdown(SIM_DESC sd) +sim_io_shutdown (SIM_DESC sd) { return STATE_CALLBACK (sd)->shutdown (STATE_CALLBACK (sd)); } int -sim_io_unlink(SIM_DESC sd, - const char *f1) +sim_io_unlink (SIM_DESC sd, + const char *f1) { return STATE_CALLBACK (sd)->unlink (STATE_CALLBACK (sd), f1); } long -sim_io_time(SIM_DESC sd, - long *t) +sim_io_time (SIM_DESC sd, + long *t) { return STATE_CALLBACK (sd)->time (STATE_CALLBACK (sd), t); } int -sim_io_system(SIM_DESC sd, const char *s) +sim_io_system (SIM_DESC sd, const char *s) { return STATE_CALLBACK (sd)->system (STATE_CALLBACK (sd), s); } int -sim_io_rename(SIM_DESC sd, - const char *f1, - const char *f2) +sim_io_rename (SIM_DESC sd, + const char *f1, + const char *f2) { return STATE_CALLBACK (sd)->rename (STATE_CALLBACK (sd), f1, f2); } int -sim_io_write_stdout(SIM_DESC sd, - const char *buf, - int len) +sim_io_write_stdout (SIM_DESC sd, + const char *buf, + int len) { switch (CURRENT_STDIO) { case DO_USE_STDIO: @@ -111,7 +111,7 @@ sim_io_write_stdout(SIM_DESC sd, void -sim_io_flush_stdout(SIM_DESC sd) +sim_io_flush_stdout (SIM_DESC sd) { switch (CURRENT_STDIO) { case DO_USE_STDIO: @@ -127,9 +127,9 @@ sim_io_flush_stdout(SIM_DESC sd) int -sim_io_write_stderr(SIM_DESC sd, - const char *buf, - int len) +sim_io_write_stderr (SIM_DESC sd, + const char *buf, + int len) { switch (CURRENT_STDIO) { case DO_USE_STDIO: @@ -147,7 +147,7 @@ sim_io_write_stderr(SIM_DESC sd, void -sim_io_flush_stderr(SIM_DESC sd) +sim_io_flush_stderr (SIM_DESC sd) { switch (CURRENT_STDIO) { case DO_USE_STDIO: @@ -163,19 +163,19 @@ sim_io_flush_stderr(SIM_DESC sd) int -sim_io_write(SIM_DESC sd, - int fd, - const char *buf, - int len) +sim_io_write (SIM_DESC sd, + int fd, + const char *buf, + int len) { return STATE_CALLBACK (sd)->write (STATE_CALLBACK (sd), fd, buf, len); } int -sim_io_read_stdin(SIM_DESC sd, - char *buf, - int len) +sim_io_read_stdin (SIM_DESC sd, + char *buf, + int len) { switch (CURRENT_STDIO) { case DO_USE_STDIO: @@ -193,123 +193,123 @@ sim_io_read_stdin(SIM_DESC sd, int -sim_io_read(SIM_DESC sd, int fd, - char *buf, - int len) +sim_io_read (SIM_DESC sd, int fd, + char *buf, + int len) { return STATE_CALLBACK (sd)->read (STATE_CALLBACK (sd), fd, buf, len); } int -sim_io_open(SIM_DESC sd, - const char *name, - int flags) +sim_io_open (SIM_DESC sd, + const char *name, + int flags) { return STATE_CALLBACK (sd)->open (STATE_CALLBACK (sd), name, flags); } int -sim_io_lseek(SIM_DESC sd, - int fd, - long off, - int way) +sim_io_lseek (SIM_DESC sd, + int fd, + long off, + int way) { return STATE_CALLBACK (sd)->lseek (STATE_CALLBACK (sd), fd, off, way); } int -sim_io_isatty(SIM_DESC sd, - int fd) +sim_io_isatty (SIM_DESC sd, + int fd) { return STATE_CALLBACK (sd)->isatty (STATE_CALLBACK (sd), fd); } int -sim_io_get_errno(SIM_DESC sd) +sim_io_get_errno (SIM_DESC sd) { return STATE_CALLBACK (sd)->get_errno (STATE_CALLBACK (sd)); } int -sim_io_close(SIM_DESC sd, - int fd) +sim_io_close (SIM_DESC sd, + int fd) { return STATE_CALLBACK (sd)->close (STATE_CALLBACK (sd), fd); } void -sim_io_printf(SIM_DESC sd, - const char *fmt, - ...) +sim_io_printf (SIM_DESC sd, + const char *fmt, + ...) { va_list ap; - va_start(ap, fmt); + va_start (ap, fmt); STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap); - va_end(ap); + va_end (ap); } void -sim_io_vprintf(SIM_DESC sd, - const char *fmt, - va_list ap) +sim_io_vprintf (SIM_DESC sd, + const char *fmt, + va_list ap) { STATE_CALLBACK (sd)->vprintf_filtered (STATE_CALLBACK (sd), fmt, ap); } void -sim_io_eprintf(SIM_DESC sd, - const char *fmt, - ...) +sim_io_eprintf (SIM_DESC sd, + const char *fmt, + ...) { va_list ap; - va_start(ap, fmt); + va_start (ap, fmt); STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap); - va_end(ap); + va_end (ap); } void -sim_io_evprintf(SIM_DESC sd, - const char *fmt, - va_list ap) +sim_io_evprintf (SIM_DESC sd, + const char *fmt, + va_list ap) { STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap); } void -sim_io_error(SIM_DESC sd, - const char *fmt, - ...) +sim_io_error (SIM_DESC sd, + const char *fmt, + ...) { if (sd == NULL || STATE_CALLBACK (sd) == NULL) { va_list ap; - va_start(ap, fmt); + va_start (ap, fmt); vfprintf (stderr, fmt, ap); - va_end(ap); + va_end (ap); fprintf (stderr, "\n"); abort (); } else { va_list ap; - va_start(ap, fmt); + va_start (ap, fmt); STATE_CALLBACK (sd)->evprintf_filtered (STATE_CALLBACK (sd), fmt, ap); - va_end(ap); + va_end (ap); STATE_CALLBACK (sd)->error (STATE_CALLBACK (sd), ""); } } void -sim_io_poll_quit(SIM_DESC sd) +sim_io_poll_quit (SIM_DESC sd) { if (STATE_CALLBACK (sd)->poll_quit != NULL && poll_quit_count-- < 0) { diff --git a/sim/common/sim-memopt.c b/sim/common/sim-memopt.c index 5892810289..89a08bcf69 100644 --- a/sim/common/sim-memopt.c +++ b/sim/common/sim-memopt.c @@ -196,7 +196,7 @@ do_memopt_add (SIM_DESC sd, if (free_buffer == 0 || free_buffer == (char*)-1) /* MAP_FAILED */ { sim_io_error (sd, "Error, cannot mmap file (%s).\n", - strerror(errno)); + strerror (errno)); } } #endif @@ -500,7 +500,7 @@ memory_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, if (mmap_next_fd < 0) { sim_io_eprintf (sd, "Cannot open file `%s': %s\n", - arg, strerror(errno)); + arg, strerror (errno)); return SIM_RC_FAIL; } diff --git a/sim/common/sim-options.c b/sim/common/sim-options.c index cfc572cff7..ddab83dbee 100644 --- a/sim/common/sim-options.c +++ b/sim/common/sim-options.c @@ -419,7 +419,7 @@ standard_option_handler (SIM_DESC sd, sim_cpu *cpu, int opt, case OPTION_ARCHITECTURE_INFO: { - const char **list = bfd_arch_list(); + const char **list = bfd_arch_list (); const char **lp; if (list == NULL) abort (); diff --git a/sim/common/sim-profile.c b/sim/common/sim-profile.c index 5f1cec3aed..7696419683 100644 --- a/sim/common/sim-profile.c +++ b/sim/common/sim-profile.c @@ -740,7 +740,7 @@ profile_print_pc (sim_cpu *cpu, int verbose) } if (ok == 0) sim_io_eprintf (sd, "Failed to write to \"gmon.out\" profile file\n"); - fclose(pf); + fclose (pf); } } diff --git a/sim/common/sim-resume.c b/sim/common/sim-resume.c index 326256877e..ddb70548f9 100644 --- a/sim/common/sim-resume.c +++ b/sim/common/sim-resume.c @@ -83,7 +83,7 @@ sim_resume (SIM_DESC sd, #ifdef SIM_CPU_EXCEPTION_RESUME { sim_cpu* cpu = STATE_CPU (sd, next_cpu_nr); - SIM_CPU_EXCEPTION_RESUME(sd, cpu, sig_to_deliver); + SIM_CPU_EXCEPTION_RESUME (sd, cpu, sig_to_deliver); } #endif diff --git a/sim/common/sim-stop.c b/sim/common/sim-stop.c index 4404e4b1bf..65881c6aea 100644 --- a/sim/common/sim-stop.c +++ b/sim/common/sim-stop.c @@ -35,9 +35,9 @@ int sim_stop (SIM_DESC sd) { ASSERT (STATE_MAGIC (sd) == SIM_MAGIC_NUMBER); - sim_events_schedule_after_signal(sd, - 0 /*NOW*/, - control_c_simulation, - sd /*data*/); + sim_events_schedule_after_signal (sd, + 0 /*NOW*/, + control_c_simulation, + sd /*data*/); return 1; } diff --git a/sim/common/syscall.c b/sim/common/syscall.c index fd5b82ab98..28816c02b5 100644 --- a/sim/common/syscall.c +++ b/sim/common/syscall.c @@ -345,12 +345,12 @@ cb_syscall (cb, sc) errcode = EINVAL; goto FinishSyscall; } - if (cb_is_stdout(cb, fd)) + if (cb_is_stdout (cb, fd)) { result = (int) (*cb->write_stdout) (cb, buf, bytes_read); (*cb->flush_stdout) (cb); } - else if (cb_is_stderr(cb, fd)) + else if (cb_is_stderr (cb, fd)) { result = (int) (*cb->write_stderr) (cb, buf, bytes_read); (*cb->flush_stderr) (cb);