From 24e7ff4ea7e35b5aed3b22dd00848a50f81fad4b Mon Sep 17 00:00:00 2001 From: Jarkko Hietaniemi Date: Wed, 28 May 2014 12:46:05 -0400 Subject: [PATCH 1/1] Move the PERL_GCC_BRACE_GROUPS_FORBIDDEN earlier. The PERL_UNUSED_RESULT needs it to avoid using the brace groups when going -pedantic. --- perl.h | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/perl.h b/perl.h index 9226d8e..7bfc445 100644 --- a/perl.h +++ b/perl.h @@ -327,6 +327,19 @@ # define PERL_UNUSED_CONTEXT #endif +/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions, + * g++ allows them but seems to have problems with them + * (insane errors ensue). + * g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2). + */ +#if defined(PERL_GCC_PEDANTIC) || \ + (defined(__GNUC__) && defined(__cplusplus) && \ + ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2)))) +# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN +# define PERL_GCC_BRACE_GROUPS_FORBIDDEN +# endif +#endif + /* Use PERL_UNUSED_RESULT() to suppress the warnings about unused results * of function calls, e.g. PERL_UNUSED_RESULT(foo(a, b)). Use it sparingly, * though, since usually the warning is there for a good reason, @@ -346,7 +359,7 @@ * extension __typeof__ and nothing else. */ #ifndef PERL_UNUSED_RESULT -# ifdef __GNUC__ +# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) # define PERL_UNUSED_RESULT(v) ({ __typeof__(v) z = (v); (void)sizeof(z); }) # else # define PERL_UNUSED_RESULT(v) ((void)(v)) @@ -473,19 +486,6 @@ # endif #endif -/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions, - * g++ allows them but seems to have problems with them - * (insane errors ensue). - * g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2). - */ -#if defined(PERL_GCC_PEDANTIC) || \ - (defined(__GNUC__) && defined(__cplusplus) && \ - ((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2)))) -# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN -# define PERL_GCC_BRACE_GROUPS_FORBIDDEN -# endif -#endif - #if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus) # ifndef PERL_USE_GCC_BRACE_GROUPS # define PERL_USE_GCC_BRACE_GROUPS -- 1.8.3.1