From: Wolfgang Stöggl Date: Fri, 25 Jan 2019 10:08:18 +0000 (+0100) Subject: Fix rc compiler redefinition warnings (nmake) X-Git-Tag: v1.7.1~12 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e82476ab1a798168b1c39c27337918e431ab6de6;p=thirdparty%2Frrdtool-1.x.git Fix rc compiler redefinition warnings (nmake) - Surround code in win32/rrd_config.h that causes warnings by rc with #ifndef RC_INVOKED and #endif. Remark: _MSC_VER is unknown to rc - Fixes the following warnings for .rc files, e.g.: rc /nologo /I./src /fo./win32/rrdtool.res ./win32\rrdtool.rc ./win32\rrd_config.h(130) : warning RC4005: 'isinf' : redefinition ./win32\rrd_config.h(131) : warning RC4005: 'isnan' : redefinition - This concerns: librrd-4.rc, rrdtool.rc, rrdupdate.rc, rrdcgi.rc, when using the resource compiler (rc) via nmake under Windows --- diff --git a/win32/rrd_config.h b/win32/rrd_config.h index a0f6a100..b2bd7c91 100644 --- a/win32/rrd_config.h +++ b/win32/rrd_config.h @@ -126,11 +126,17 @@ #include "mkstemp.h" +/* _MSC_VER is not defined, when using the resource compiler (rc). + * See: https://docs.microsoft.com/en-us/windows/desktop/menurc/predefined-macros + * for how to conditionally compile the code with the RC compiler using RC_INVOKED +*/ +#ifndef RC_INVOKED #if _MSC_VER < 1900 #define isinf(a) (_fpclass(a) == _FPCLASS_NINF || _fpclass(a) == _FPCLASS_PINF) #define isnan _isnan #define snprintf _snprintf #endif +#endif #define finite _finite #define rrd_realloc(a,b) ( (a) == NULL ? malloc( (b) ) : realloc( (a) , (b) ))