On 2016-02-06 17:03:34 +0000, Junges, Sebastian wrote: > Dear developers, > > We are successfully using gmp in several of our projects. Thanks for all the > efforts you put into the project. > I’m fully aware that compilation time warnings are not the same as bugs, > however, I still would like to draw your attention to the following three > warnings I get during compilation of files including gmp.h. > They prevent simple usage of -Werror. > > /usr/local/include/gmp.h:2139:345: warning: equality comparison with > extraneous parentheses [-Wparentheses-equality] > do { mp_size_t __gmp_i; mp_limb_t __gmp_x; __gmp_i = (__gmp_ysize); if > (__gmp_i != 0) { if (__gmpn_add_n (__gmp_wp, __gmp_xp, __gmp_yp, __gmp_i)) { > do { if (__gmp_i >= (__gmp_xsize)) { (__gmp_c) = 1; goto __gmp_done; } > __gmp_x = (__gmp_xp)[__gmp_i]; } while ((((__gmp_wp)[__gmp_i++] = (__gmp_x + > 1) & ((~ (static_cast<mp_limb_t> (0))) >> 0)) == 0)); } } if ((__gmp_wp) != > (__gmp_xp)) do { mp_size_t __gmp_j; ; for (__gmp_j = (__gmp_i); __gmp_j < > (__gmp_xsize); __gmp_j++) (__gmp_wp)[__gmp_j] = (__gmp_xp)[__gmp_j]; } while > (0); (__gmp_c) = 0; __gmp_done: ; } while (0);
This one may be impossible to "fix". If I understand correctly, you can produce such a warning with something like: #define FOO (a == b) while (FOO) { ... } Due to how the C preprocessor works, extraneous parentheses may happen. Emitting a warning in such a case is a bad idea. In gmp.h, this probably comes from: #define __GMPN_ADD(cout, wp, xp, xsize, yp, ysize) \ __GMPN_AORS (cout, wp, xp, xsize, yp, ysize, mpn_add_n, \ (((wp)[__gmp_i++] = (__gmp_x + 1) & GMP_NUMB_MASK) == 0)) The extraneous parentheses should be useless here if the __GMPN_AORS macro is correctly written, though they may be regarded as safer. -- Vincent Lefèvre <vinc...@vinc17.net> - Web: <https://www.vinc17.net/> 100% accessible validated (X)HTML - Blog: <https://www.vinc17.net/blog/> Work: CR INRIA - computer arithmetic / AriC project (LIP, ENS-Lyon) _______________________________________________ gmp-bugs mailing list gmp-bugs@gmplib.org https://gmplib.org/mailman/listinfo/gmp-bugs