Skip to content

Commit fcb8529

Browse files
authored
Merge pull request #2002 from harmenwierenga/fix_build_for_cygwin
Fix issues that prevent compilation in Cygwin
2 parents d3b6e79 + 4477a1c commit fcb8529

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

src/clib/CMakeLists.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -175,8 +175,8 @@ endif ()
175175

176176
include(CheckTypeSize)
177177
check_type_size("size_t" SIZEOF_SIZE_T)
178-
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
179-
if (NOT ${SIZEOF_SIZE_T} EQUAL ${SIZEOF_LONG_LONG})
178+
check_type_size("long long" SIZEOF_LONG_LONG)
179+
if (NOT "${SIZEOF_SIZE_T}" STREQUAL "${SIZEOF_LONG_LONG}")
180180
message (FATAL_ERROR "size_t and long long must be the same size!")
181181
endif ()
182182

src/clib/pioc_support.c

+14
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,15 @@
99
#include <pio.h>
1010
#include <pio_internal.h>
1111

12+
#if defined __has_include
13+
#if __has_include (<execinfo.h>)
14+
#define PLATFORM_HAS_EXECINFO
15+
#endif /* __has_include (<execinfo.h>) */
16+
#endif /* __has_include */
17+
18+
#ifdef PLATFORM_HAS_EXECINFO
1219
#include <execinfo.h>
20+
#endif /* PLATFORM_HAS_EXECINFO */
1321

1422
/** This is used with text decomposition files. */
1523
#define VERSNO 2001
@@ -522,6 +530,7 @@ pio_log(int severity, const char *fmt, ...)
522530
void
523531
print_trace(FILE *fp)
524532
{
533+
#ifdef PLATFORM_HAS_EXECINFO
525534
void *array[10];
526535
size_t size;
527536
char **strings;
@@ -540,6 +549,9 @@ print_trace(FILE *fp)
540549
fprintf(fp,"%s\n", strings[i]);
541550

542551
free(strings);
552+
#else
553+
(void)fp;
554+
#endif /* PLATFORM_HAS_EXECINFO */
543555
}
544556

545557
/**
@@ -1532,6 +1544,7 @@ pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmode,
15321544
strlen(my_order_str) + 1, my_order_str)))
15331545
return pio_err(ios, NULL, ret, __FILE__, __LINE__);
15341546

1547+
#ifdef PLATFORM_HAS_EXECINFO
15351548
/* Write an attribute with the stack trace. This can be helpful
15361549
* for debugging. */
15371550
void *bt[MAX_BACKTRACE];
@@ -1562,6 +1575,7 @@ pioc_write_nc_decomp_int(iosystem_desc_t *ios, const char *filename, int cmode,
15621575
if ((ret = PIOc_put_att_text(ncid, NC_GLOBAL, DECOMP_BACKTRACE_ATT_NAME,
15631576
strlen(full_bt) + 1, full_bt)))
15641577
return pio_err(ios, NULL, ret, __FILE__, __LINE__);
1578+
#endif /* PLATFORM_HAS_EXECINFO */
15651579

15661580
/* We need a dimension for the dimensions in the data. (Example:
15671581
* for 4D data we will need to store 4 dimension IDs.) */

0 commit comments

Comments
 (0)