Hi,

The attached patch fixes several warnings when building on an x86_64
system. The changes are trivial.

Most of the issues stem from the fact that:

1) a variable of type long is 8 bytes on x86_64, but is 4 bytes on IA32
2) hex literals with the suffix 'ul' are 8 bytes on x86_64, meaning
several checks would never be true (due to ~0x0ul being 0xffffffff on
IA32 but 0xffffffff_ffffffff on x86_64)

I've tested the affected sections and the changes appear to have not
affected functionality. Patch was tested on an x86_64 and IA32 system
with recent gcc (4.3.2). Hopefully it doesn't break anything else. ;-)

Cheers,
Phil
Index: src/helper/command.c
===================================================================
--- src/helper/command.c        (revision 1522)
+++ src/helper/command.c        (working copy)
@@ -782,8 +782,8 @@
                busy_sleep(duration);
        } else
        {
-               long long then=timeval_ms();
-               while ((timeval_ms()-then)<duration)
+               unsigned long then = timeval_ms();
+               while (timeval_ms() - then < duration)
                {
                        target_call_timer_callbacks_now();
                        usleep(1000);
Index: src/target/etb.c
===================================================================
--- src/target/etb.c    (revision 1522)
+++ src/target/etb.c    (working copy)
@@ -453,7 +453,7 @@
                arm7_9->etm_ctx->capture_driver_priv = etb;
 
                etb->tap  = tap;
-               etb->cur_scan_chain = ~0UL;
+               etb->cur_scan_chain = 0xffffffff;
                etb->reg_cache = NULL;
                etb->ram_width = 0;
                etb->ram_depth = 0;
Index: src/target/xscale.c
===================================================================
--- src/target/xscale.c (revision 1522)
+++ src/target/xscale.c (working copy)
@@ -2933,7 +2933,8 @@
                                                (((instruction.type == ARM_B) ||
                                                        (instruction.type == 
ARM_BL) ||
                                                        (instruction.type == 
ARM_BLX)) &&
-                                                       
(instruction.info.b_bl_bx_blx.target_address != ~0UL)))
+                                                       
(instruction.info.b_bl_bx_blx.target_address != 
+                                                        0xffffffff)))
                                        {
                                                xscale->trace.current_pc = 
instruction.info.b_bl_bx_blx.target_address;
                                        }
Index: src/target/etm.c
===================================================================
--- src/target/etm.c    (revision 1522)
+++ src/target/etm.c    (working copy)
@@ -998,7 +998,7 @@
                        if (((instruction.type == ARM_B) ||
                                (instruction.type == ARM_BL) ||
                                (instruction.type == ARM_BLX)) &&
-                               (instruction.info.b_bl_bx_blx.target_address != 
~0UL))
+                               (instruction.info.b_bl_bx_blx.target_address != 
0xffffffffUL))
                        {
                                next_pc = 
instruction.info.b_bl_bx_blx.target_address;
                        }
Index: src/flash/mflash.c
===================================================================
--- src/flash/mflash.c  (revision 1522)
+++ src/flash/mflash.c  (working copy)
@@ -473,14 +473,16 @@
        residue = sect_cnt % 256;
 
        for (i = 0; i < quotient; i++) {
-               LOG_DEBUG("sect num : %u buff : 0x%8.8x", sect_num, 
(u32)buff_ptr);
+               LOG_DEBUG("sect num : %u buff : 0x%0lx", sect_num, 
+                       (unsigned long)buff_ptr);
                mg_mflash_do_read_sects(buff_ptr, sect_num, 256);
                sect_num += 256;
                buff_ptr += 256 * MG_MFLASH_SECTOR_SIZE;
        }
 
        if (residue) {
-               LOG_DEBUG("sect num : %u buff : %8.8x", sect_num, 
(u32)buff_ptr);
+               LOG_DEBUG("sect num : %u buff : %0lx", sect_num, 
+                       (unsigned long)buff_ptr);
                mg_mflash_do_read_sects(buff_ptr, sect_num, residue);
        }
 
@@ -542,14 +544,16 @@
        residue = sect_cnt % 256;
 
        for (i = 0; i < quotient; i++) {
-               LOG_DEBUG("sect num : %u buff : %8.8x", sect_num, 
(u32)buff_ptr);
+               LOG_DEBUG("sect num : %u buff : %0lx", sect_num, 
+                       (unsigned long)buff_ptr);
                mg_mflash_do_write_sects(buff_ptr, sect_num, 256);
                sect_num += 256;
                buff_ptr += 256 * MG_MFLASH_SECTOR_SIZE;
        }
 
        if (residue) {
-               LOG_DEBUG("sect num : %u buff : %8.8x", sect_num, 
(u32)buff_ptr);
+               LOG_DEBUG("sect num : %u buff : %0lx", sect_num, 
+                       (unsigned long)buff_ptr);
                mg_mflash_do_write_sects(buff_ptr, sect_num, residue);
        }
 
_______________________________________________
Openocd-development mailing list
Openocd-development@lists.berlios.de
https://lists.berlios.de/mailman/listinfo/openocd-development

Reply via email to