Greets,
When "-pedantic" is added to the flags passed to the C compiler, a
bunch of spurious warnings show up, e.g...
KinoSearch.c: In function 'XS_KinoSearch__Util__PriorityQueue_pop':
KinoSearch.c:3884: warning: ISO C forbids braced-groups within
expressions
These trace back to Perl macros, specifically STMT_START and
STMT_END. Here's how SvCUR_set is defined in the Perl 5.8.8 source:
#define SvCUR_set(sv, val) \
STMT_START { \
(((XPV*) SvANY(sv))->xpv_cur = (val)); } STMT_END
... and here's STMT_START and STMT_END:
/*
* STMT_START { statements; } STMT_END;
* can be used as a single statement, as in
* if (x) STMT_START { ... } STMT_END; else ...
*
* Trying to select a version that gives no warnings...
*/
#if !(defined(STMT_START) && defined(STMT_END))
# if defined(__GNUC__) && !defined
(PERL_GCC_BRACE_GROUPS_FORBIDDEN) && !defined(__cplusplus)
# define STMT_START (void)( /* gcc supports
"({ STATEMENTS; })" */
# define STMT_END )
# else
/* Now which other defined()s do we need here ??? */
# if (VOIDFLAGS) && (defined(sun) || defined(__sun__)) && !
defined(__GNUC__)
# define STMT_START if (1)
# define STMT_END else (void)0
# else
# define STMT_START do
# define STMT_END while (0)
# endif
# endif
#endif
I'm working on an OS X box, so it's using the Apple-modified gcc,
which causes the first of the three definitions to be used. That's
not ISO-compliant, hence all the warnings. There are plenty of other
warnings, too, all of which I believe would go away if I could
convince the compiler to use the ISO strict macros.
This doesn't cause any errors, but it introduces a lot of noise when
I turn on -pedantic, which makes it a lot harder to track down stuff
that really is problematic -- like those C99 "anywhere"
declarations. Turning on "-ansi" piles on a whole lot more noise in
addition.
Any suggestions?
Marvin Humphrey
Rectangular Research
http://www.rectangular.com/