Skip to content

Commit

Permalink
Merge pull request #2002 from harmenwierenga/fix_build_for_cygwin
Browse files Browse the repository at this point in the history
Fix issues that prevent compilation in Cygwin
  • Loading branch information
jedwards4b authored Feb 14, 2025
2 parents d3b6e79 + 4477a1c commit fcb8529
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/clib/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -175,8 +175,8 @@ endif ()

include(CheckTypeSize)
check_type_size("size_t" SIZEOF_SIZE_T)
CHECK_TYPE_SIZE("long long" SIZEOF_LONG_LONG)
if (NOT ${SIZEOF_SIZE_T} EQUAL ${SIZEOF_LONG_LONG})
check_type_size("long long" SIZEOF_LONG_LONG)
if (NOT "${SIZEOF_SIZE_T}" STREQUAL "${SIZEOF_LONG_LONG}")
message (FATAL_ERROR "size_t and long long must be the same size!")
endif ()

Expand Down
14 changes: 14 additions & 0 deletions src/clib/pioc_support.c
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,15 @@
#include <pio.h>
#include <pio_internal.h>

#if defined __has_include
#if __has_include (<execinfo.h>)
#define PLATFORM_HAS_EXECINFO
#endif /* __has_include (<execinfo.h>) */
#endif /* __has_include */

#ifdef PLATFORM_HAS_EXECINFO
#include <execinfo.h>
#endif /* PLATFORM_HAS_EXECINFO */

/** This is used with text decomposition files. */
#define VERSNO 2001
Expand Down Expand Up @@ -522,6 +530,7 @@ pio_log(int severity, const char *fmt, ...)
void
print_trace(FILE *fp)
{
#ifdef PLATFORM_HAS_EXECINFO
void *array[10];
size_t size;
char **strings;
Expand All @@ -540,6 +549,9 @@ print_trace(FILE *fp)
fprintf(fp,"%s\n", strings[i]);

free(strings);
#else
(void)fp;
#endif /* PLATFORM_HAS_EXECINFO */
}

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

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

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

0 comments on commit fcb8529

Please sign in to comment.