On 04/27/2014 02:11 PM, Jarkko Hietaniemi wrote: > On Sunday-201404-27, 15:57, Craig A. Berry wrote: >> It's complaining about the return value, which we're doing our best to >> throw away and thereby emulate a void gconvert: > > I am confused: what's wrong with (void)? > >> http://perl5.git.perl.org/perl.git/blobdiff/04783dc7025287c5d75ab531602c7ec786a1e787..cca0492ec62cab786a01ea96c47e549fe0aa8c61:/sv.c >> > > "void Gconvert: on Linux at least, gcvt (which Gconvert gets deffed > to),has a mandatory return value" - how "mandatory" are we talking about? > >> I don't think it's doing any real harm, but warnings that need to be >> ignored tend to accumulate and then it's too easy to ignore all >> warnings. > > Indeed. > Actually, there is another way to handle these warnings that hadn't been put into Perl at the time this commit was made. These lines in perl.h describe it ====================== /* on gcc (and clang), specify that a warning should be temporarily * ignored; e.g. * * GCC_DIAG_IGNORE(-Wmultichar); * char b = 'ab'; * GCC_DIAG_RESTORE; * * based on http://dbp-consulting.com/tutorials/SuppressingGCCWarnings.html * * Note that "pragma GCC diagnostic push/pop" was added in GCC 4.6, Mar 2011; * clang only pretends to be GCC 4.2, but still supports push/pop. */ #if defined(__clang) || \ (defined( __GNUC__) && ((__GNUC__ * 100) + __GNUC_MINOR__) >= 406) # define GCC_DIAG_DO_PRAGMA_(x) _Pragma (#x) # define GCC_DIAG_IGNORE(x) _Pragma("GCC diagnostic push") \ GCC_DIAG_DO_PRAGMA_(GCC diagnostic ignored #x) # define GCC_DIAG_RESTORE _Pragma("GCC diagnostic pop") #else # define GCC_DIAG_IGNORE(w) # define GCC_DIAG_RESTORE #endif ====================== And I used it for this particular warning in locale.c GCC_DIAG_IGNORE(-Wunused-result); (void) mbtowc(&wc, NULL, 0); /* Reset any shift state */ GCC_DIAG_RESTORE; I think this is preferable to the current V_Gconvert solutionThread Previous | Thread Next