Skip to content

Commit 7f32236

Browse files
committed
Changes for MinGW non WINAPI path handling
1 parent c3a772a commit 7f32236

13 files changed

Lines changed: 296 additions & 277 deletions

File tree

.github/workflows/build_windows.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444
- name: Install Cygwin and build dependencies
4545
uses: cygwin/cygwin-install-action@v6
4646
with:
47-
packages: autoconf, automake, binutils, gcc-core, gettext-devel, git, libtool, make, pkg-config
47+
packages: autoconf, automake, binutils, curl, gcc-core, gettext-devel, git, libtool, make, pkg-config
4848
platform: x86_64
4949
add-to-path: true
5050
- name: Download test data
@@ -87,7 +87,7 @@ jobs:
8787
with:
8888
msystem: MINGW64
8989
update: true
90-
install: autoconf automake gettext gettext-devel git libtool make mingw-w64-x86_64-gcc pkg-config
90+
install: autoconf automake curl git libtool make mingw-w64-x86_64-gcc mingw-w64-x86_64-gettext-runtime mingw-w64-x86_64-gettext-tools pkg-config
9191
- name: Download test data
9292
shell: msys2 {0}
9393
run: |

.github/workflows/check_source.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ jobs:
3333
make > /dev/null
3434
- name: Run tests
3535
run: |
36-
make check CHECK_WITH_ASAN=1 CHECK_WITH_STDERR=1
36+
tests/runtests.sh
3737
scan_build:
3838
name: Check source with scan-build
3939
runs-on: ${{ matrix.os }}
@@ -124,4 +124,4 @@ jobs:
124124
make > /dev/null
125125
- name: Run tests
126126
run: |
127-
make check CHECK_WITH_STDERR=1
127+
tests/runtests.sh

.github/workflows/coverage.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
- name: Install Cygwin and build dependencies
2020
uses: cygwin/cygwin-install-action@v6
2121
with:
22-
packages: autoconf, automake, curl, gettext-devel, git, libtool, make, mingw-w64-x86_64-gcc, pkg-config
22+
packages: autoconf, automake, binutils, curl, gcc-core, gettext-devel, git, libtool, make, pkg-config
2323
platform: x86_64
2424
add-to-path: true
2525
- name: Download test data
@@ -119,7 +119,7 @@ jobs:
119119
with:
120120
msystem: MINGW64
121121
update: true
122-
install: autoconf automake gettext gettext-devel git libtool make mingw-w64-x86_64-gcc pkg-config
122+
install: autoconf automake curl git libtool make mingw-w64-x86_64-gcc mingw-w64-x86_64-gettext-runtime mingw-w64-x86_64-gettext-tools pkg-config
123123
- name: Download test data
124124
shell: msys2 {0}
125125
run: |

common/byte_stream.h

Lines changed: 61 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,68 @@
2929
extern "C" {
3030
#endif
3131

32-
#define _BYTE_STREAM_HOST_IS_ENDIAN_BIG ( *((uint32_t *) "\x01\x02\x03\x04" ) == 0x01020304 )
33-
#define _BYTE_STREAM_HOST_IS_ENDIAN_LITTLE ( *((uint32_t *) "\x01\x02\x03\x04" ) == 0x04030201 )
34-
#define _BYTE_STREAM_HOST_IS_ENDIAN_MIDDLE ( *((uint32_t *) "\x01\x02\x03\x04" ) == 0x02010403 )
32+
#define _BYTE_STREAM_ENDIAN_BIG 'b'
33+
#define _BYTE_STREAM_ENDIAN_LITTLE 'l'
34+
#define _BYTE_STREAM_ENDIAN_MIDDLE 'm'
3535

36-
#define _BYTE_STREAM_ENDIAN_BIG (uint8_t) 'b'
37-
#define _BYTE_STREAM_ENDIAN_LITTLE (uint8_t) 'l'
38-
#define _BYTE_STREAM_ENDIAN_MIDDLE (uint8_t) 'm'
36+
#undef _BYTE_STREAM_HOST_BYTE_ORDER
37+
38+
#if defined( __BYTE_ORDER__ ) && defined( __ORDER_LITTLE_ENDIAN__ ) && defined( __ORDER_BIG_ENDIAN__ ) && defined( __ORDER_PDP_ENDIAN__ )
39+
#if __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__
40+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_BIG
41+
42+
#elif __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__
43+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_LITTLE
44+
45+
#elif __BYTE_ORDER__ == __ORDER_PDP_ENDIAN__
46+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_MIDDLE
47+
#endif
48+
49+
#elif defined( __linux__ ) || defined( __GLIBC__ )
50+
#include <endian.h>
51+
52+
#if defined( __BYTE_ORDER ) && defined( __LITTLE_ENDIAN ) && defined( __BIG_ENDIAN ) && defined( __PDP_ENDIAN )
53+
#if __BYTE_ORDER == __BIG_ENDIAN
54+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_BIG
55+
56+
#elif __BYTE_ORDER == __LITTLE_ENDIAN
57+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_LITTLE
58+
59+
#elif __BYTE_ORDER == __PDP_ENDIAN
60+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_MIDDLE
61+
62+
#endif
63+
#endif
64+
65+
#elif defined( __APPLE__ ) || defined( __FreeBSD__ ) || defined( __OpenBSD__ ) || defined( __NetBSD__ )
66+
#include <machine/endian.h>
67+
68+
#if defined( BYTE_ORDER ) && defined( LITTLE_ENDIAN ) && defined( BIG_ENDIAN )
69+
#if BYTE_ORDER == BIG_ENDIAN
70+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_BIG
71+
72+
#elif BYTE_ORDER == LITTLE_ENDIAN
73+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_LITTLE
74+
75+
#endif
76+
#endif
77+
78+
#elif defined( _MSC_VER ) || defined( _WIN32 )
79+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_LITTLE
80+
81+
#elif defined( __hppa__ ) || defined( __m68k__ ) || defined( __mips__ ) || defined( __powerpc__ ) || defined( __sparc__ )
82+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_BIG
83+
84+
#elif defined( __i386__ ) || defined( __x86_64__ ) || defined( __arm__ ) || defined( __aarch64__ )
85+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_LITTLE
86+
87+
#elif defined( __pdp11__ )
88+
#define _BYTE_STREAM_HOST_BYTE_ORDER _BYTE_STREAM_ENDIAN_MIDDLE
89+
#endif
90+
91+
#if !defined( _BYTE_STREAM_HOST_BYTE_ORDER )
92+
#error "Unable to determine host byte-order"
93+
#endif
3994

4095
typedef union byte_stream_float32
4196
{

include/libcpath/definitions.h.in

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,13 +30,11 @@
3030
*/
3131
#define LIBCPATH_VERSION_STRING "@VERSION@"
3232

33-
#if defined( WINAPI )
33+
#if defined( WINAPI ) || defined( __MINGW32__ )
3434
#define LIBCPATH_SEPARATOR '\\'
35-
3635
#else
3736
#define LIBCPATH_SEPARATOR '/'
38-
39-
#endif /* defined( WINAPI ) */
37+
#endif
4038

4139
#endif /* !defined( _LIBCPATH_DEFINITIONS_H ) */
4240

libcpath/libcpath_definitions.h.in

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -41,23 +41,19 @@
4141
*/
4242
#define LIBCPATH_VERSION_STRING "@VERSION@"
4343

44-
#if defined( WINAPI )
44+
#if defined( WINAPI ) || defined( __MINGW32__ )
4545
#define LIBCPATH_SEPARATOR '\\'
46-
4746
#else
4847
#define LIBCPATH_SEPARATOR '/'
49-
50-
#endif /* defined( WINAPI ) */
48+
#endif
5149

5250
#endif /* !defined( HAVE_LOCAL_LIBCPATH ) */
5351

54-
#if defined( WINAPI )
52+
#if defined( WINAPI ) || defined( __MINGW32__ )
5553
#define LIBCPATH_ESCAPE_CHARACTER '^'
56-
5754
#else
5855
#define LIBCPATH_ESCAPE_CHARACTER '\\'
59-
60-
#endif /* defined( WINAPI ) */
56+
#endif
6157

6258
#if defined( WINAPI )
6359
enum LIBCPATH_TYPES

0 commit comments

Comments
 (0)