59c5d74bd333b5e2a11b22f1bb29f512a6eb9c7a hiram Thu Jan 2 17:37:11 2025 -0800 ifdef the code for the ArraySize macro so the older compiler will see what it usually sees and the new one sees what it wants - TO BE FIXED - eventually refs #34990 diff --git src/inc/common.h src/inc/common.h index 34b0451..7de3761 100644 --- src/inc/common.h +++ src/inc/common.h @@ -157,35 +157,42 @@ * and create our own. Our implementation is the same as used on Solaris. */ #if defined(__va_copy) && !defined(va_copy) # define va_copy __va_copy #endif #if !defined(va_copy) # define va_copy(to, from) ((to) = (from)) #endif /* Cast a pointer to a long long. Use to printf format points as long-longs * in a 32/64bit portable manner. Format should use %llx for the result. * Needed because casting a pointer to a different sized number cause a * warning with gcc */ #define ptrToLL(p) ((long long)((size_t)p)) +/* older compiler on hgwdev can use this macro without checking */ +#if defined(__STDC__) && (__STDC__ == 1) && (__STDC_ISO_10646__ == 201103L) +#define ArraySize(a) (sizeof(a)/sizeof((a)[0])) +#else + +// for newer compilers, use this format to avoid the error exit on warning // TODO GALT This is a temporary work around. -#pragma GCC diagnostic ignored "-Wsizeof-pointer-div" +// #pragma GCC diagnostic ignored "-Wsizeof-pointer-div" /* How big is this array? */ #define ArraySize(a) (sizeof(a)/sizeof((a)[0])) +#endif #define uglyf printf /* debugging printf */ #define uglyAbort errAbort /* debugging error abort. */ #define uglyOut stdout /* debugging fprintf target. */ size_t memCheckPoint(); /* Return the amount of memory allocated since last called. */ void *needMem(size_t size); /* Need mem calls abort if the memory allocation fails. The memory * is initialized to zero. */ void *needLargeMem(size_t size); /* This calls abort if the memory allocation fails. The memory is * not initialized to zero. */