Skip to content

Commit 24e7ff4

Browse files
committed
Move the PERL_GCC_BRACE_GROUPS_FORBIDDEN earlier.
The PERL_UNUSED_RESULT needs it to avoid using the brace groups when going -pedantic.
1 parent 4a7a918 commit 24e7ff4

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

perl.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -327,6 +327,19 @@
327327
# define PERL_UNUSED_CONTEXT
328328
#endif
329329

330+
/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
331+
* g++ allows them but seems to have problems with them
332+
* (insane errors ensue).
333+
* g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
334+
*/
335+
#if defined(PERL_GCC_PEDANTIC) || \
336+
(defined(__GNUC__) && defined(__cplusplus) && \
337+
((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
338+
# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
339+
# define PERL_GCC_BRACE_GROUPS_FORBIDDEN
340+
# endif
341+
#endif
342+
330343
/* Use PERL_UNUSED_RESULT() to suppress the warnings about unused results
331344
* of function calls, e.g. PERL_UNUSED_RESULT(foo(a, b)). Use it sparingly,
332345
* though, since usually the warning is there for a good reason,
@@ -346,7 +359,7 @@
346359
* extension __typeof__ and nothing else.
347360
*/
348361
#ifndef PERL_UNUSED_RESULT
349-
# ifdef __GNUC__
362+
# if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN)
350363
# define PERL_UNUSED_RESULT(v) ({ __typeof__(v) z = (v); (void)sizeof(z); })
351364
# else
352365
# define PERL_UNUSED_RESULT(v) ((void)(v))
@@ -473,19 +486,6 @@
473486
# endif
474487
#endif
475488

476-
/* gcc (-ansi) -pedantic doesn't allow gcc statement expressions,
477-
* g++ allows them but seems to have problems with them
478-
* (insane errors ensue).
479-
* g++ does not give insane errors now (RMB 2008-01-30, gcc 4.2.2).
480-
*/
481-
#if defined(PERL_GCC_PEDANTIC) || \
482-
(defined(__GNUC__) && defined(__cplusplus) && \
483-
((__GNUC__ < 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ < 2))))
484-
# ifndef PERL_GCC_BRACE_GROUPS_FORBIDDEN
485-
# define PERL_GCC_BRACE_GROUPS_FORBIDDEN
486-
# endif
487-
#endif
488-
489489
#if defined(__GNUC__) && !defined(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
490490
# ifndef PERL_USE_GCC_BRACE_GROUPS
491491
# define PERL_USE_GCC_BRACE_GROUPS

0 commit comments

Comments
 (0)