This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug libc/17679] Can't use htole*, htobe*, __bswap* functions in static/global context


https://sourceware.org/bugzilla/show_bug.cgi?id=17679

--- Comment #1 from Dan Streetman <ddstreet at ieee dot org> ---
Created attachment 7996
  --> https://sourceware.org/bugzilla/attachment.cgi?id=7996&action=edit
Patch to add tests to tst-bswap and tst-endian

This patch adds tests for this bug.  When building, you can clearly see the
failure:

In file included from ../bits/byteswap.h:34:0,
                 from ../string/byteswap.h:24,
                 from ../include/byteswap.h:1,
                 from tst-bswap.c:19:
../bits/byteswap-16.h:26:6: error: braced-group within expression allowed only
inside a function
      ({ unsigned short int __bsx = (unsigned short int) (x);        \
      ^
tst-bswap.c:28:28: note: in expansion of macro â__bswap_16â
 static __uint16_t swap16 = __bswap_16(0x1234);
                            ^
tst-bswap.c:31:1: error: initializer element is not constant
 static __uint32_t swap32 = __bswap_32(0x12345678);
 ^
tst-bswap.c:34:1: error: initializer element is not constant
 static __uint64_t swap64 = __bswap_64(0x1234567890abcdefULL);
 ^

-- 
You are receiving this mail because:
You are on the CC list for the bug.

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]