+2019-01-21 Keith Marshall <keith@users.osdn.me>
+
+ Handle another GCC compile-time warning.
+
+ * mingwex/memalign.c (is_power_of_two): Use in-line expansion...
+ (memalign_is_power_of_two): ...of this new function; this is required
+ to avoid -Wsequence-point warnings, which may arise when testing the
+ result of an assignment expression passed as the macro argument.
+
2019-01-11 Keith Marshall <keith@users.osdn.me>
Fix a mkstemp() file name generator defect.
* $Id$
*
* Written by Keith Marshall <keith@users.osdn.me>
- * Copyright (C) 2018, MinGW.org Project
+ * Copyright (C) 2018, 2019, MinGW.org Project
*
* Derived (with extensive modification) from, and replacing, the original
* mingw-aligned-malloc.c implementation:
* values, and bailing out, in the event of violation of this, or any other
* parameter validation criterion.
*/
-#define is_power_of_two(x) (((x) > 0) && (((x) & ((x) - 1)) == 0))
+#define is_power_of_two(x) memalign_is_power_of_two((x))
#define error_return(c,r) {errno = (c); return (r);}
/* We need "sizeof_ptr" to represent the smallest integer power of two
* functions; (declare them as __CRT_ALIAS, to ensure that GCC will
* always expand them in-line).
*/
+__CRT_ALIAS int memalign_is_power_of_two( int x )
+{
+ /* This furnishes the implementation of the is_power_of_two() macro,
+ * as an in-line function expansion, to avoid GCC warnings which may
+ * arise as side effects of passing an assignment as macro parameter.
+ */
+ return ((x > 0) && ((x & (x -1)) == 0));
+}
+
__CRT_ALIAS size_t memalign_min_alignment( void )
{
/* This determines the size of a structure comprising a single byte