Skip to content

Commit

Permalink
byteswap.h: fix gcc ver test for __builtin_bswap{32,64}
Browse files Browse the repository at this point in the history
The __builtin_bswap* functions were introduced in gcc-4.3, not gcc-4.2.
Fix the __GNUC_PREREQ tests to reflect this.

Otherwise trying to compile code with gcc-4.2 falls down:
In file included from /usr/include/endian.h:60,
                 from /usr/include/ctype.h:40,
/usr/include/bits/byteswap.h: In function 'unsigned int __bswap_32(unsigned int)':
/usr/include/bits/byteswap.h:46: error: '__builtin_bswap32' was not declared in this scope
/usr/include/bits/byteswap.h: In function 'long long unsigned int __bswap_64(long long unsigned int)':
/usr/include/bits/byteswap.h:110: error: '__builtin_bswap64' was not declared in this scope

Signed-off-by: Mike Frysinger <vapier@gentoo.org>
  • Loading branch information
Mike Frysinger committed Dec 3, 2012
1 parent a69646e commit c9d6789
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
2012-12-03 Mike Frysinger <vapier@gentoo.org>

* bits/byteswap.h [__GNUC__]: Change __GNUC_PREREQ from 4.2 to 4.3.
* sysdeps/x86/bits/byteswap.h [__GNUC__]: Likewise.

2012-12-03 Jeff Law <law@redhat.com>

* time/sys/time.h (settimeofday): Do not mark TV argument
Expand Down
4 changes: 2 additions & 2 deletions bits/byteswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
(((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))

#ifdef __GNUC__
# if __GNUC_PREREQ (4, 2)
# if __GNUC_PREREQ (4, 3)
static __inline unsigned int
__bswap_32 (unsigned int __bsx)
{
Expand Down Expand Up @@ -70,7 +70,7 @@ __bswap_32 (unsigned int __bsx)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56)))

# if __GNUC_PREREQ (4, 2)
# if __GNUC_PREREQ (4, 3)
static __inline __uint64_t
__bswap_64 (__uint64_t __bsx)
{
Expand Down
4 changes: 2 additions & 2 deletions sysdeps/x86/bits/byteswap.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
(((x) & 0x0000ff00) << 8) | (((x) & 0x000000ff) << 24))

#ifdef __GNUC__
# if __GNUC_PREREQ (4, 2)
# if __GNUC_PREREQ (4, 3)
static __inline unsigned int
__bswap_32 (unsigned int __bsx)
{
Expand Down Expand Up @@ -104,7 +104,7 @@ __bswap_32 (unsigned int __bsx)
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56)))

# if __GNUC_PREREQ (4, 2)
# if __GNUC_PREREQ (4, 3)
static __inline __uint64_t
__bswap_64 (__uint64_t __bsx)
{
Expand Down

0 comments on commit c9d6789

Please sign in to comment.