Subject: | "Constant subroutine LOG_FACMASK redefined" on Haiku-OS |
With the change in RT #77577 Syslog successfully builds under bleadperl,
but during make test, I see:
~/dev/perl/git/perl/t> ./perl harness ../cpan/Sys-Syslog/t/*.t
../cpan/Sys-Syslog/t/00-load.t .... Constant subroutine LOG_FACMASK
redefined at ../../lib/Sys/Syslog.pm line -1.
../cpan/Sys-Syslog/t/00-load.t .... ok
../cpan/Sys-Syslog/t/constants.t .. Constant subroutine LOG_FACMASK
redefined at ../../lib/Sys/Syslog.pm line -1.
../cpan/Sys-Syslog/t/constants.t .. ok
../cpan/Sys-Syslog/t/syslog.t ..... Constant subroutine LOG_FACMASK
redefined at ../../lib/Sys/Syslog.pm line -1.
../cpan/Sys-Syslog/t/syslog.t ..... ok
All tests successful.
Files=3, Tests=309, 1 wallclock secs ( 0.04 usr 0.01 sys + 0.33 cusr
0.11 csys = 0.48 CPU)
Result: PASS
This happens because Haiku-OS doesn't define LOG_FACMASK, so at the
point const-c.inc is included LOC_FACMASK isn't defined, so it defines a
LOG_FACMASK using the fallback value.
The LOG_FACMASK macro is then defined and const-xs.inc is included, that
file seeing the macro is defined also creates a CONSTSUB, producing the
warning above.
Moving the macro definition above the const-c.inc include prevents the
warning.
~/dev/perl/git/perl/t> ./perl harness ../cpan/Sys-Syslog/t/*.t
../cpan/Sys-Syslog/t/00-load.t .... ok
../cpan/Sys-Syslog/t/constants.t .. ok
../cpan/Sys-Syslog/t/syslog.t ..... ok
All tests successful.
Files=3, Tests=309, 1 wallclock secs ( 0.04 usr 0.01 sys + 0.34 cusr
0.11 csys = 0.49 CPU)
Result: PASS
I've attached a patch with the fix. It's also present in the haiku
branch at:
https://github.com/tonycoz/Sys-Syslog/tree/haiku
Tony
Subject: | facmask.patch |
diff --git a/Syslog.xs b/Syslog.xs
index 4bdbb3b..729ce9c 100644
--- a/Syslog.xs
+++ b/Syslog.xs
@@ -31,17 +31,17 @@
static SV *ident_svptr;
+#ifndef LOG_FAC
+#define LOG_FACMASK 0x03f8
+#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
+#endif
+
#include "const-c.inc"
#ifndef LOG_PRIMASK
#define LOG_PRIMASK 7
#endif
-#ifndef LOG_FAC
-#define LOG_FACMASK 0x03f8
-#define LOG_FAC(p) (((p) & LOG_FACMASK) >> 3)
-#endif
-
#ifndef LOG_PRI
#define LOG_PRI(p) ((p) & LOG_PRIMASK)
#endif