Skip to content

Commit

Permalink
Add option to enable legacy macros.
Browse files Browse the repository at this point in the history
  • Loading branch information
WardF committed Sep 25, 2024
1 parent a7077c6 commit de7992c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 6 deletions.
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -547,6 +547,11 @@ else()
set(NETCDF_ENABLE_HDF4 OFF)
endif()

# Option legacy macros
# Do we want to enable unsafe macros, e.g. _FillValue in addition to NC_FillValue.
# See https://github.com/Unidata/netcdf-c/issues/3029
option(NETCDF_ENABLE_LEGACY_MACROS "Enable legacy macros for backwards compatibility. Use with Caution." OFF)

# Option Logging, only valid for netcdf4 dispatchers.
option(NETCDF_ENABLE_LOGGING "Enable Logging." OFF)
if(NOT NETCDF_ENABLE_NETCDF4)
Expand Down
3 changes: 3 additions & 0 deletions config.h.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -496,6 +496,9 @@ with zip */
/* Idspatch table version */
#cmakedefine NC_DISPATCH_VERSION ${NC_DISPATCH_VERSION}

/* Enable Legacy, potential-conflict Macro _FillValue */
#cmakedefine NETCDF_ENABLE_LEGACY_MACROS

/* no IEEE float on this platform */
#cmakedefine NO_IEEE_FLOAT 1

Expand Down
12 changes: 6 additions & 6 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -464,13 +464,13 @@ fi

# Do we want to enable unsafe macros, e.g. _FillValue in addition to NC_FillValue.
# See https://github.com/Unidata/netcdf-c/issues/3029
AC_MSG_CHECKING([whether to allow unsafe macros])
AC_ARG_ENABLE([unsafe-macros],
[AS_HELP_STRING([--enable-unsafe-macros],
[enable unsafe macros for backwards compatibility purposes. Use with caution.\
AC_MSG_CHECKING([whether to allow legacy macros])
AC_ARG_ENABLE([legacy-macros],
[AS_HELP_STRING([--enable-legacy-macros],
[enable legacy macros for backwards compatibility purposes. Use with caution.\
This can lead to unexpected consequences/behavior.])])
if test "x$enable_unsafe_macros" = xyes; then
AC_DEFINE([NETCDF_ENABLE_LEGACY_MACROS], 1, [If true, enable unsafe macros in netcdf.h])
if test "x$enable_legacy_macros" = xyes; then
AC_DEFINE([NETCDF_ENABLE_LEGACY_MACROS], 1, [If true, enable legacy macros in netcdf.h])
fi

# Does the user want to allow reading of remote data via range headers?
Expand Down

0 comments on commit de7992c

Please sign in to comment.