Skip to content

Commit 524c8b4

Browse files
committed
Avoid __BIG_ENDIAN__
This is pre-defined by GCC on _some_ platforms. Here, we don't want GCC pre-defined setting but instead want our own setting to test both little and big-endian settings.
1 parent 9ce5c3a commit 524c8b4

File tree

4 files changed

+6
-21
lines changed

4 files changed

+6
-21
lines changed

regression/cbmc/Pointer_array7/big-endian.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE new-smt-backend
22
main.c
3-
--big-endian -D__BIG_ENDIAN__
3+
--big-endian -DUSE_BIG_ENDIAN
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc/Pointer_array7/main.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
#include <assert.h>
22
#include <stdint.h>
33

4-
#if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
4+
#if !defined(USE_LITTLE_ENDIAN) && !defined(USE_BIG_ENDIAN)
55

66
# if defined(__avr32__) || defined(__hppa__) || defined(__m68k__) || \
77
defined(__mips__) || defined(__powerpc__) || defined(__s390__) || \
88
defined(__s390x__) || defined(__sparc__)
99

10-
# define __BIG_ENDIAN__
10+
# define USE_BIG_ENDIAN
1111

1212
# endif
1313

@@ -21,7 +21,7 @@ int main()
2121
uint8_t *y = (uint8_t *)x;
2222
uint16_t z = *((uint16_t *)(y + 1));
2323

24-
#ifdef __BIG_ENDIAN__
24+
#ifdef USE_BIG_ENDIAN
2525
assert(z == 256u);
2626
#else
2727
assert(z == 512u);

regression/cbmc/Pointer_array7/test.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
CORE new-smt-backend
22
main.c
3-
--little-endian -D__LITTLE_ENDIAN__
3+
--little-endian -DUSE_LITTLE_ENDIAN
44
^EXIT=0$
55
^SIGNAL=0$
66
^VERIFICATION SUCCESSFUL$

regression/cbmc/Struct_Bytewise1/struct_bytewise.c

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,3 @@
1-
// Determine endianness.
2-
// Follows http://wiki.debian.org/ArchitectureSpecificsMemo
3-
4-
#if !defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
5-
6-
#if defined(__avr32__) || defined(__hppa__) || defined(__m68k__) || \
7-
defined(__mips__) || defined(__powerpc__) || defined(__s390__) || \
8-
defined(__s390x__) || defined(__sparc__)
9-
10-
#define __BIG_ENDIAN__
11-
12-
#endif
13-
14-
#endif
15-
161
typedef struct my_struct
172
{
183
// We hope these are 32 bit each on all architectures,
@@ -37,7 +22,7 @@ int main()
3722
logAppl.b=0x01000002;
3823
CopyBuffer((unsigned char *)&logAppl);
3924

40-
#ifdef __BIG_ENDIAN__
25+
#if defined(__BYTE_ORDER__) && __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
4126
assert(arrayTmp[0]==0);
4227
assert(arrayTmp[1]==0);
4328
assert(arrayTmp[2]==0);

0 commit comments

Comments
 (0)