[haiku-commits] Re: haiku: hrev47278 - headers/os/support src/add-ons/kernel/busses/scsi/ahci src/system/kernel/arch/x86 src/system/runtime_loader

  • From: Paweł Dziepak <pdziepak@xxxxxxxxxxx>
  • To: haiku-commits@xxxxxxxxxxxxx
  • Date: Thu, 29 May 2014 14:28:40 +0200

2014-05-29 14:20 GMT+02:00  <jessica.l.hamilton@xxxxxxxxx>:
> hrev47278 adds 1 changeset to branch 'master'
> old head: 221ea8a17ec6f9eba0a436c6d0a6271eb7faec4d
> new head: 44ec21c3ff3eb22693333ad429b1972206223754
> overview: http://cgit.haiku-os.org/haiku/log/?qt=range&q=44ec21c+%5E221ea8a
>
> ----------------------------------------------------------------------------
>
> 44ec21c: ByteOrder.h: simplify compiler test
>
>   * A problem with our gcc requires adding casts for gcc4 when
>     the __builtin_bswap functions are used with a format string

That's not true anymore.

>   * Unlike gcc2, the __builtin_bswap functions do not get disabled
>     despite using -fno-builtins, hence added compiler check in
>     runtime_loader/utility.cpp
>
>                          [ Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx> ]
>
> ----------------------------------------------------------------------------
>
> Revision:    hrev47278
> Commit:      44ec21c3ff3eb22693333ad429b1972206223754
> URL:         http://cgit.haiku-os.org/haiku/commit/?id=44ec21c
> Author:      Jessica Hamilton <jessica.l.hamilton@xxxxxxxxx>
> Date:        Thu May 29 12:12:45 2014 UTC
>
> ----------------------------------------------------------------------------
>
> 4 files changed, 7 insertions(+), 10 deletions(-)
> headers/os/support/ByteOrder.h                    | 6 +-----
> src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp | 4 ++--
> src/system/kernel/arch/x86/arch_debug.cpp         | 4 ++--
> src/system/runtime_loader/utility.cpp             | 3 ++-
>
> ----------------------------------------------------------------------------
>
> diff --git a/headers/os/support/ByteOrder.h b/headers/os/support/ByteOrder.h
> index 9952769..de6e959 100644
> --- a/headers/os/support/ByteOrder.h
> +++ b/headers/os/support/ByteOrder.h
> @@ -120,11 +120,7 @@ extern bool is_type_swapped(type_code type);
>  /* Private implementations */
>  extern double __swap_double(double arg);
>  extern float  __swap_float(float arg);
> -#if (defined(__INTEL__) || defined(__x86_64__)) && GCC_VERSION >= 40300
> -#define __swap_int64(arg)      __builtin_bswap64(arg)
> -#define __swap_int32(arg)      __builtin_bswap32(arg)
> -#define __swap_int16(arg)      __builtin_bswap16(arg)
> -#elif defined(__ARM__) && GCC_VERSION >= 40800
> +#if __GNUC__ >= 4
>  #define __swap_int64(arg)      __builtin_bswap64(arg)
>  #define __swap_int32(arg)      __builtin_bswap32(arg)
>  #define __swap_int16(arg)      __builtin_bswap16(arg)

These definitions lack appropriate casts. GCC builtins return uint{16,
32, 64}_t while we expect __swap_int*() to return [u]int{16, 32, 64}.

> diff --git a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp 
> b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp
> index a742908..4b2576d 100644
> --- a/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp
> +++ b/src/add-ons/kernel/busses/scsi/ahci/ahci_port.cpp
> @@ -819,8 +819,8 @@ AHCIPort::ScsiUnmap(scsi_ccb* request, 
> scsi_unmap_parameter_list* unmapBlocks)
>  dprintf("TRIM SCSI:\n");
>  for (uint32 i = 0; i < scsiRangeCount; i++) {
>         dprintf("[%3" B_PRIu32 "] %" B_PRIu64 " : %" B_PRIu32 "\n", i,
> -               B_BENDIAN_TO_HOST_INT64(unmapBlocks->blocks[i].lba),
> -               B_BENDIAN_TO_HOST_INT32(unmapBlocks->blocks[i].block_count));
> +               (uint64)B_BENDIAN_TO_HOST_INT64(unmapBlocks->blocks[i].lba),
> +               
> (uint32)B_BENDIAN_TO_HOST_INT32(unmapBlocks->blocks[i].block_count));
>  }

These casts should not be needed.

<snip, other cases of unnecessary casts>

Paweł

Other related posts: