ARM11: remove needless string format #ifdeffery
authorDavid Brownell <dbrownell@users.sourceforge.net>
Sun, 22 Nov 2009 18:21:22 +0000 (10:21 -0800)
committerDavid Brownell <dbrownell@users.sourceforge.net>
Sun, 22 Nov 2009 18:27:29 +0000 (10:27 -0800)
We don't need to use size_t in these places; so it's easy
to be rid of the need for this #ifdef and its MS-derived
portability problems.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
src/target/arm11.c
src/target/arm11.h
src/target/arm11_dbgtap.c

index 9c427050cf2261619dc8bc3b7f0b149b6067b7d0..1a7b4e0d8b29054a238b20b7f2f2fa552c80bc34 100644 (file)
@@ -448,15 +448,16 @@ static int arm11_leave_debug_state(struct arm11_common *arm11)
 
        /* restore R1 - R14 */
 
-       for (size_t i = 1; i < 15; i++)
+       for (unsigned i = 1; i < 15; i++)
        {
                if (!arm11->reg_list[ARM11_RC_RX + i].dirty)
                        continue;
 
                /* MRC p14,0,r?,c0,c5,0 */
-               arm11_run_instr_data_to_core1(arm11, 0xee100e15 | (i << 12), R(RX + i));
+               arm11_run_instr_data_to_core1(arm11,
+                               0xee100e15 | (i << 12), R(RX + i));
 
-               //      LOG_DEBUG("RESTORE R" ZU " %08x", i, R(RX + i));
+               //      LOG_DEBUG("RESTORE R%u %08x", i, R(RX + i));
        }
 
        retval = arm11_run_instr_data_finish(arm11);
@@ -742,7 +743,7 @@ static int arm11_resume(struct target *target, int current,
 
                /* set all breakpoints */
 
-               size_t          brp_num = 0;
+               unsigned brp_num = 0;
 
                for (bp = target->breakpoints; bp; bp = bp->next)
                {
@@ -757,7 +758,8 @@ static int arm11_resume(struct target *target, int current,
 
                        arm11_sc7_run(arm11, brp, ARRAY_SIZE(brp));
 
-                       LOG_DEBUG("Add BP " ZU " at %08" PRIx32 "", brp_num, bp->address);
+                       LOG_DEBUG("Add BP %d at %08" PRIx32, brp_num,
+                                       bp->address);
 
                        brp_num++;
                }
@@ -1869,7 +1871,14 @@ static int arm11_build_reg_cache(struct target *target)
                ARM11_REGCACHE_COUNT != ARRAY_SIZE(arm11_reg_defs) ||
                ARM11_REGCACHE_COUNT != ARM11_RC_MAX)
        {
-               LOG_ERROR("BUG: arm11->reg_values inconsistent (%d " ZU " " ZU " %d)", ARM11_REGCACHE_COUNT, ARRAY_SIZE(arm11->reg_values), ARRAY_SIZE(arm11_reg_defs), ARM11_RC_MAX);
+               LOG_ERROR("BUG: arm11->reg_values inconsistent (%d %u %u %d)",
+                               ARM11_REGCACHE_COUNT,
+                               (unsigned) ARRAY_SIZE(arm11->reg_values),
+                               (unsigned) ARRAY_SIZE(arm11_reg_defs),
+                               ARM11_RC_MAX);
+               /* FIXME minimally, use a build_bug_on(X) mechanism;
+                * runtime exit() here is bad!
+                */
                exit(-1);
        }
 
index 79f4b6b92e07481ce9549cbab7f84382a4a5e3ff..0b379294225195ab7eb5727f757dcacf258a0ac8 100644 (file)
 #define NEW(type, variable, items)                     \
        type * variable = calloc(1, sizeof(type) * items)
 
-/* For MinGW use 'I' prefix to print size_t (instead of 'z') */
-/* Except if __USE_MINGW_ANSI_STDIO is defined with MinGW    */
-
-#if (!defined(__MSVCRT__) || defined(__USE_MINGW_ANSI_STDIO))
-#define ZU             "%zu"
-#else
-#define ZU             "%Iu"
-#endif
-
-
 /* TEMPORARY -- till we switch to the shared infrastructure */
 #define ARM11_REGCACHE_COUNT           20
 
index bdbcc8f3890ecdf921aaeebd137031fe0d5c7d3d..0f7e4953ab8af55217c00d52e0936d2d94c9c363 100644 (file)
@@ -588,12 +588,13 @@ int arm11_run_instr_data_to_core_noack(struct arm11_common * arm11, uint32_t opc
        arm11_setup_field(arm11,  1,    NULL,                   NULL,                           chain5_fields + 2);
 
        uint8_t                 *Readies;
-       size_t readiesNum = (count + 1);
-       size_t bytes = sizeof(*Readies)*readiesNum;
+       unsigned readiesNum = count + 1;
+       unsigned bytes = sizeof(*Readies)*readiesNum;
+
        Readies = (uint8_t *) malloc(bytes);
        if (Readies == NULL)
        {
-               LOG_ERROR("Out of memory allocating " ZU " bytes", bytes);
+               LOG_ERROR("Out of memory allocating %u bytes", bytes);
                return ERROR_FAIL;
        }
 
@@ -626,7 +627,7 @@ int arm11_run_instr_data_to_core_noack(struct arm11_common * arm11, uint32_t opc
        int retval = jtag_execute_queue();
        if (retval == ERROR_OK)
        {
-               size_t error_count = 0;
+               unsigned error_count = 0;
 
                for (size_t i = 0; i < readiesNum; i++)
                {
@@ -637,7 +638,8 @@ int arm11_run_instr_data_to_core_noack(struct arm11_common * arm11, uint32_t opc
                }
 
                if (error_count > 0 )
-                       LOG_ERROR(ZU " words out of " ZU " not transferred", error_count, readiesNum);
+                       LOG_ERROR("%u words out of %u not transferred",
+                               error_count, readiesNum);
 
        }
 

Linking to existing account procedure

If you already have an account and want to add another login method you MUST first sign in with your existing account and then change URL to read https://review.openocd.org/login/?link to get to this page again but this time it'll work for linking. Thank you.

SSH host keys fingerprints

1024 SHA256:YKx8b7u5ZWdcbp7/4AeXNaqElP49m6QrwfXaqQGJAOk gerrit-code-review@openocd.zylin.com (DSA)
384 SHA256:jHIbSQa4REvwCFG4cq5LBlBLxmxSqelQPem/EXIrxjk gerrit-code-review@openocd.org (ECDSA)
521 SHA256:UAOPYkU9Fjtcao0Ul/Rrlnj/OsQvt+pgdYSZ4jOYdgs gerrit-code-review@openocd.org (ECDSA)
256 SHA256:A13M5QlnozFOvTllybRZH6vm7iSt0XLxbA48yfc2yfY gerrit-code-review@openocd.org (ECDSA)
256 SHA256:spYMBqEYoAOtK7yZBrcwE8ZpYt6b68Cfh9yEVetvbXg gerrit-code-review@openocd.org (ED25519)
+--[ED25519 256]--+
|=..              |
|+o..   .         |
|*.o   . .        |
|+B . . .         |
|Bo. = o S        |
|Oo.+ + =         |
|oB=.* = . o      |
| =+=.+   + E     |
|. .=o   . o      |
+----[SHA256]-----+
2048 SHA256:0Onrb7/PHjpo6iVZ7xQX2riKN83FJ3KGU0TvI0TaFG4 gerrit-code-review@openocd.zylin.com (RSA)