2
0
mirror of https://github.com/Unidata/netcdf-c.git synced 2025-02-23 16:59:54 +08:00

Add option to enable legacy macros.

This commit is contained in:
Ward Fisher 2024-09-25 11:34:10 -05:00
parent a7077c6e6e
commit de7992c0e0
3 changed files with 14 additions and 6 deletions

View File

@ -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)

View File

@ -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

View File

@ -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?